Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

dynamic swing panel  RSS feed

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys
I have a swing form , the left side of the form is constant (plus button minus button and list)
The right side of the form is dynamic,

For example if it�s a person, I will inherit the form and set its right side to controls I choose , the + and � buttons allow me to drop / add a person , and right side will manipulate the person info.
For a car, the right side will contain different types of controls because of the different type of data, but the left side will stay the same, and allow me to manipulate the list .

What is the correct way to make the right side replaceable?
I can use different JFrames for each type of data, but some parts of the window are permanent, and I don�t always know what type of controls will be on the right side .

Thank you
Sharon.
[ July 21, 2006: Message edited by: Sharon whipple ]
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest checking out javax.swing.JSplitPane with two javax.swing.JPanels.
[ July 21, 2006: Message edited by: Nick Meverden ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSplitPanes are a great solution. But whether you go with the JSplitPane approach or towards more of a dockable panel solution, your panel on the right needs to change. It's usually as simple as creating a new JPanel with the components you need and doing a simple swap.
 
Mark Noah
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you mean by "doing a simple swap"?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Noah:
What did you mean by "doing a simple swap"?


Replacing one JPanel with another. component.remove(panel); component.add(panel) <-- psuedo code there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!