LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-30-2009, 06:59 PM   #1
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Rep: Reputation: 15
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
 
Old 06-30-2009, 09:44 PM   #2
kellinwood
Member
 
Registered: Jan 2006
Location: Culver City, California
Distribution: Fedora
Posts: 64

Rep: Reputation: 21
Add both panels to the JFrame. In the event handler for the button click, call panelA.setVisible( false); and panelB.setVisible(true);
 
Old 06-30-2009, 10:05 PM   #3
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Original Poster
Rep: Reputation: 15
The listener is on JFrame or JPanel?
 
Old 07-01-2009, 09:28 AM   #4
kellinwood
Member
 
Registered: Jan 2006
Location: Culver City, California
Distribution: Fedora
Posts: 64

Rep: Reputation: 21
from the listener attached to the button via button.addActionListener( listener);

Ken
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
swing jframe listener questions kpachopoulos Programming 1 03-19-2006 04:32 PM
java JFrame sizes. byteframe Programming 8 10-25-2005 02:09 AM
Resizing a JFrame when JPanel resizes? 95se Programming 1 03-23-2005 04:48 PM
[JAVA] JPanel over JPanel ... not being displayed properly linux_ub Programming 0 08-13-2004 11:21 AM
(java) mouselistener in JPanel dave bean Programming 6 01-27-2004 12:44 PM


All times are GMT -5. The time now is 06:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration