Results 1 to 8 of 8
Thread: Multiple Menu Program
- 04-03-2010, 11:11 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 1
- Rep Power
- 0
Multiple Menu Program
Hi,
I want to create a program in Java, and I am using JFrames for my GUI. What the program does is that it has some buttons on a JFrame and each button does an event. One of this buttons has to lead in a new menu.
I have decided that the best way to do this is to create two JFrames, set the one to visible (i.e. setVisible(true)) and the other one invisible (i.e setVisible(false))
When I press on the button I want the first frame to become invisible and the second one visible so I will be able to view the new menu.
Is there any way to do this? If you want my code so far I can post it here, just let me know guys.
Thanks
-
Rather than swap JFrames, how about instead swapping JPanels by using a CardLayout?
- 04-04-2010, 03:09 PM #3
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
How about using the add(Component c) and remove(Component c) then use the repaint and revalidate. I think it would be better.
- 04-04-2010, 09:00 PM #4
-
- 04-05-2010, 04:53 AM #6
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Actually the remove/add/revalidate/repaint is just for the menu to display or not.
thunderbird could actually create an constructor to the second frame containing the data of the first frame as its parameter. setVisible(boolean flag) isn't a best solution, in terms of memory consumption.
BTW, can anyone help me on my thread regarding 'how to reload JIF'. Thanks.Last edited by chyrl; 04-05-2010 at 05:00 AM.
- 04-05-2010, 12:40 PM #7
Member
- Join Date
- Jul 2008
- Posts
- 62
- Rep Power
- 0
> BTW, can anyone help me on my thread regarding 'how to reload JIF'.
despite a several requests for a more detailed explanation of the problem,
you continue with your 'feet on the desk' attitude, waiting for someone else to do the work.
I'd love to be your boss, well, I wouldn't be 'your boss' for long.
- 04-05-2010, 04:15 PM #8
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Similar Threads
-
Connecting to Multiple Clients in a Chat Program
By Gregadeaux in forum NetworkingReplies: 0Last Post: 12-09-2009, 01:41 AM -
multiple program
By mm2236 in forum Threads and SynchronizationReplies: 2Last Post: 10-02-2009, 12:27 PM -
Working on a menu program...using exceptions
By Nightwarrior in forum New To JavaReplies: 0Last Post: 04-16-2009, 04:40 AM -
need menu program
By student_doesntget_java in forum New To JavaReplies: 2Last Post: 03-20-2009, 09:58 AM -
how to record multiple input names and output later in program
By jbajwa1 in forum New To JavaReplies: 4Last Post: 10-02-2008, 10:05 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks