Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dynamic swing panel

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What did you mean by "doing a simple swap"?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic