-   Programming (
-   -   Java JFrame and JPanel listener (

hunterfighter 06-30-2009 06:59 PM

Java JFrame and JPanel listener

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

kellinwood 06-30-2009 09:44 PM

Add both panels to the JFrame. In the event handler for the button click, call panelA.setVisible( false); and panelB.setVisible(true);

hunterfighter 06-30-2009 10:05 PM

The listener is on JFrame or JPanel?

kellinwood 07-01-2009 09:28 AM

from the listener attached to the button via button.addActionListener( listener);


All times are GMT -5. The time now is 08:50 AM.