The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Swing UI with multiple Frames??

Posted by Matt Gerrans on October 30, 2001 at 5:02 PM

You might want to try using a JTabbedPane. Then you can create all your panels once and the user can flip between them.

- mfg

> Hi, I'm a confused VB programmer with heaps of server side Java programming under my belt, but I'm stuffed if I can work out how to create a GUI with Swing. I have an application that has 4 "screens". I have it working at the moment but it creates a new frame every time I want to go to the next "screen", then I can't figure out how to close the previous frame.

> More specifically, I have: JFrame mainWindow, which loads a JPanel containing the required buttons e.t.c. I set the context to be the JPanel and life is good. then when I press a button, I create a new JFrame (which is wrong I think), and set it's context to be my new panel. What I'd like to be able to do is display a selection of different panels from the main frame (or figure out how to dispose a frame from within a panel??


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us