Two Laptop Bag*
The moose likes Swing / AWT / SWT and the fly likes Simple multi piece applet GUI using Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Simple multi piece applet GUI using Swing" Watch "Simple multi piece applet GUI using Swing" New topic
Author

Simple multi piece applet GUI using Swing

Bryan Spain
Greenhorn

Joined: Mar 20, 2011
Posts: 2
Hi all. I am fairly new to GUI development in swing and just need a push in the right direction.

I am writing a chatroom applet that will have multiple "views"... for instance, the login view, the chatroom view, and the settings view.

What is a good approach to put the login view and the chatroom view in the same "window/frame/container". My goal is to be able to have them both in the same place on the screen and just switch between them as appropriate. Originally I thought it would be something along the lines of creating a JFrame with two JPanels, then adding the login panel and the chatroom panel to this. From here I would call "setVisible" to control what is currently showing. It doesn't appear that this is working smoothly, so I wanted to get an opinion on good ways to do this so I can either change my approach or debug what I have already.

Thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Use a CardLayout.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
. . . and welcome to the Ranch
 
Don't get me started about those stupid light bulbs.
 
subject: Simple multi piece applet GUI using Swing
 
Similar Threads
I am NOT a Swing beginner...SWING BOOKS?
Swing Window Communication.
Beginning GUI programming exercise. Please help to figure out why it does not compile.
Questions regarding to using applets and JComponents
Still having some trouble with Observer/Observable