• 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

JPanel to collapse

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a JPanel with many option to personlize the settings. Since it is too much to start with for the user, I would like to collapse the view and than open it with plus/arrow so the full menue is available. Please let me know if/how I need to transfer may be the JPanel into something else.
Thanks for you help.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knut Nilson wrote:Hello,
I have a JPanel with many option to personlize the settings. Since it is too much to start with for the user, I would like to ...


Have you considered using a JTabbedPane? a tabbed pane is a fairly standard programming idiom for multiple settings.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like an expander. At least, that's what GTK+ calls it. That's not hard to implement; I've done it myself a while ago already.

The setup is pretty basic. You have a main panel with a BorderLayout. At the top you have your controller panel, with the expand / collapse button and its label. In the center you have the main component, mostly a JPanel. Expanding means showing the main component (setVisible(true)), collapsing means hiding it (setVisible(false)).
 
Knut Nilson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on it, but what I struggle with is to put the CheckBox in the TiledBorder. This is what I have, do you have an additional hint:



To: Darryl Burke
Tabbed Pane is not applicable for this scenario, since I need to be able to show options in one view. But thanks for the hint, if I don't find anything else I now have a plan B
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't use borders that require interaction. Or at least it will be quite tricky. The reason is that a border is "eye candy" - it only determines how it's painted, nothing more. Like I said in my previous post (in other words), using a BorderLayout with a component at BorderLayout.NORTH would be a lot easier.
 
Knut Nilson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your patients, I will than do this. I know how that is working.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knut Nilson wrote:what I struggle with is to put the CheckBox in the TiledBorder.



May be just what the doctor ordered: Rob Camick's Component Border.

Knut Nilson wrote:To: Darryl Burke
Tabbed Pane is not applicable for this scenario, since I need to be able to show options in one view. But thanks for the hint, if I don't find anything else I now have a plan B


You're welcome.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic