Hi.
I'm developing an application designed to work in touch screens. Therefore I need to use JButtons to close the JFrames I use.
The question is how can I simulate a click on the JFrame close button?
So far what I'm doing is call this.dispose() when the user clicks my button.
The frame closes, but if the user opens it again all the data that was in the text boxes and other components will appear again. If I click on the close button the frame will close and if the user opens the frame again everything comes with no data as it should.
The default close operation of my JFrame is also dispose on close.
What seems to me is that when I call dispose the garbage collector doesn't remove the references to my JFrame and therefore if its opened again it comes with all the data that was in it. If I press the JFrame close button the garbage collector automatically cleans the memory references to the JFrame and therefore if the user opens it again it will come with no data.
So how exactly should I do this?
TIA
I'm developing an application designed to work in touch screens. Therefore I need to use JButtons to close the JFrames I use.
The question is how can I simulate a click on the JFrame close button?
So far what I'm doing is call this.dispose() when the user clicks my button.
The frame closes, but if the user opens it again all the data that was in the text boxes and other components will appear again. If I click on the close button the frame will close and if the user opens the frame again everything comes with no data as it should.
The default close operation of my JFrame is also dispose on close.
What seems to me is that when I call dispose the garbage collector doesn't remove the references to my JFrame and therefore if its opened again it comes with all the data that was in it. If I press the JFrame close button the garbage collector automatically cleans the memory references to the JFrame and therefore if the user opens it again it will come with no data.
So how exactly should I do this?
TIA