This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, I want to open multiple frames from a parent frame. I am creating an application. In that I've one main frame along with menus. Using those menus I'm calling another frames in that frame. How to call other frames in the main parent frame ? Any suggestion / code ... [ July 27, 2005: Message edited by: Sumit Mhatre ]
If you're going to have one main frame of the application and the menu selections are just going to change what is going to be displayed in the frame, I suggest you only create one frame. Then you create custom panel classes to be displayed within that frame. When a menu item is chosen, call a method within the frame to reload with a different panel specified by the menu selection. If you create all the panels upon frame construction, you should be able to save their states even when they aren't being displayed.
Another simpler option might be to use a JTabbedPane and forget about using the menu to navigate the application.
This is exactly what I am looking to do. I am new to Java but I am in a tight bind in learning how to do a GUI from Java by next week. I have been working with JBuilder and the way I want to do my GUI is to have a menu that will display the different panels the user chooses.
Does anyone have an example of this that I could see?
Any advice or tutorials someone might have that talks about calling multiple panels in a single Frame or Window would be great.
I should of been more specific sorry. I want the user to open up new windows or panels when he or she selects a certain menubar option.
Joined: Jun 09, 2003
if you want multiple windows (frames) showing, reply #1 in this thread is the start of what you have to do.
if you only want the one window (frame) showing, but the panel displayed is dependent on user (menu) selection, CardLayout is your best option.
Joined: Oct 04, 2005
Thanks for the info. I will try and find something on how cardlayout works. If anyone can point me to a good tutorial on this or some advice as to how to set this up that would be great. Otherwise, thanks again.