-
2 Attachment(s)
NetBeans-style GUI
Hi all,
I would like to design a GUI where a panel can be collapsed on left part of a Jframe, just like the attached pictures, where *Favorites* window can be minimized or restored.
Attachment 457Attachment 458
What's more, hover with mouse pointer over the minimized *Favorites* icon will pop up until mouse pointer stays on it.
These pictures are from Chartsy Homepage - Chartsy.org - The Free Stock Charting, Screening and Trading Platform, a NetBeans project: I use NetBeans but have no clue how to do this.
Any helps greatly appreciated.
Regards,
Susie
-
Re: NetBeans-style GUI
Not fully sure what you are after, but you can just add/remove/swap components from a container, which would be the easiest way to go about this. When a user hits a button to collapse you just remove/swap the component and revalidate.
-
Re: NetBeans-style GUI
Thanks for your reply copeg, I will try to as from your suggestions.
Susie
-
Re: NetBeans-style GUI
-
Re: NetBeans-style GUI
Yes I did, for my GUI I use a SplitPane and I can collapse left part, but I think the above example is a little different since once collapsed it creates an icon on the left side, just like in NetBeans.
Susie
-
Re: NetBeans-style GUI
Yes, and copeg's suggestion is a solid one. Or you could try collapsing the JSplitPane to, say 5% or so, instead of all the way, then showing a button on the left side.
But to go along with copeg's idea, CardLayout will be your friend: How to Use CardLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)
-
Re: NetBeans-style GUI
Kevin's advice is spot on - JSplitPane would be ideal for one state of the above, and you can use one or a combination of removing/adding components and a CardLayout. One last thought however: whichever route you choose, I'd recommend encapsulating the behavior so it can be re-used...in other words, write a JComponent/JPanel that behaves in this way - and you just need to instantiate it with the appropriate parameters - rather than building it up each time.
-
Re: NetBeans-style GUI
Thank you both for your suggestions