Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Swapping JPanels

Status
Not open for further replies.

TheRealDels

Programmer
Jul 26, 2001
11
0
0
AU
Hi, I'm building a FiloFax program to store everyday needed information.

I've subclassed JPanel into a JPanLogon, JPanAddress, JPanBookmarks. Each of which is JPanel with text boxes etc that captures information I use daily, they all look different and store different information.

I was using them in my FiloFax program, having a JComboBox at the top and a JPanel below. Depending on which type of information was chosen to be looked at in the combo, the JPanel below would be assigned to either of my subclasses.

Problem :
I can assign one of my subclasses to this JPanel during the constructor with = new JPanLogon() etc.
However, I can't dynamically change this, ie in the JComboBox change algorithm, I have tried,
= new JPanAddress(); which doesn't produce an error but it doesn't diplay the other JPanel.
Why ???

+ Is using one JPanel as the housing for one of a set of JPanel subclasses or objects the best way or should I create multiple JPanel objects in the same place and toggle the view attributes on them ?
 
You must use CardLayout=> u can display any Panel u want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top