Java JFrame and JPanel listener
Hi,
Currently, I am doing a program. I will have few JPanel and only one JFrame. By default, JFrame will show a JPanel (Panel A), in full screen. I implement a button in Panel A to call the Panel B. How am I to realize this coding? Panel A will be either remove or disappear from the JFrame and add Panel B into the JFrame. Thank you |
Add both panels to the JFrame. In the event handler for the button click, call panelA.setVisible( false); and panelB.setVisible(true);
|
The listener is on JFrame or JPanel?
|
from the listener attached to the button via button.addActionListener( listener);
Ken |
All times are GMT -5. The time now is 11:08 PM. |