+ 4

Changing content of the page on clicking

In Java swing how to change the content of the page/frame when a button is clicked. Well using "dispose()", "setVisible (false)", "setDefaultCloseOperation (Frame.HIDE_ON_CLOSE)" are not effective rather after a bit delay new frame opens when a button is clicked but i want only content should be changed doing so there will be no delay. So please help me out in achieving this. Thanks

2nd Sep 2017, 5:08 PM
Mohammad Aasim
3 Respostas
+ 2
I have achieved this using "Card Layout".Card layout makes the layers of cards/panels on one another and it provides multiple function to navigate which includes : next (container panel), previous (container panel), first (container panel), last (container panel), show (container panel, "specified_string").
22nd Sep 2017, 6:51 AM
Mohammad Aasim
+ 4
bro .. that can be done in java (gui) ... through netbeans IDE , where u hv components like buttons, text fields, textareas,panels,labels etc but here... its java (non-gui)... i mean u cannot do it here ..... ________________________________________________________ for java ( gui ) .... //let u hv to move on NewJFrame2 , then u hv type what i am typing in source code of button which is in your present frame:::: NewJFrame2 nf = new NewJFrame2 (); this.setVIsible (false); nf.setVisible (true); //this is what i know ,,,, hope it helps ☺
2nd Sep 2017, 5:16 PM
Changed
Changed - avatar
+ 3
Thanks for response. i have mentioned 3 approaches including you suggested but the problem with this approach is that while changing the frame a bit delay occurred with blink and then frame gets changed. What i want is that only the content of the frame should change not the frame as reloading of frame decreases the performance of the application. I think now problem is clear to you.
3rd Sep 2017, 5:27 AM
Mohammad Aasim