This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Creating a Window with JPanels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Creating a Window with JPanels" Watch "Creating a Window with JPanels" New topic

Creating a Window with JPanels

Mabel Ahmad

Joined: Feb 03, 2006
Posts: 8
So far I am only able to create a window with my current constuctor. I would also like to add a few JPanels that I have created onto it but they are not showing up. Can someone please help me? Thank you!

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
your UserInterface constructor appears to be in the wrong order.
setVisible(true) should be moved to the last line of the constructor

although not a big problem, it would be less confusing (to others)
if you set the layout prior to adding the components.
subject: Creating a Window with JPanels