• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Collapsible Panel?

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to make a collapsible pane and I am running into all kinds of problems (probably because I am very new to swing).

I want it to look something like this

(Collapsed look)
+ Panel One
+ Panel Two
+ Panel Three

(Expanded look)
- Panel One
Text Field 1
Text Field 2
- Panel Two
Text Field 1
Text Field 2
- Panel Three
Text Field 1
Text Field 2

Where + is collapsed and - is expanded. So really I want the +/- to either be icons or just use text. I was trying to implement this using swingx (Specifically JXCollapsiblePanel) but I am having trouble making it work with text as a button (since I don't really want it to look like a button) or with an icon. Has anyone ever done anything like this before? If so I could really use some help/direction.

Thanks,
Billy
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Craig Wood's ExpandingPanels() might do the trick

https://coderanch.com/t/341737/GUI/java/Expand-Collapse-Panels
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are there no APIs already out there that would do the trick? I think swingx might work really well but I cannot get it to do what I want (again it probably will but I am a rookie).
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
swingx is what I was looking for. I am still exploring but here is a quick example:

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sashi,
Welcome to the Ranch.

Please do not hijack other people's post You can start a new thread and post your question there, by clicking on at the top/bottom right of this page.

Check this out for tips on getting the most out of the Ranch.
 
We must storm this mad man's lab and destroy his villanous bomb! Are you with me tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic