Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: NetBeans-style GUI

  1. #1
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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.

    A00100.jpgA00099.jpg

    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


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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.

  3. #3
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: NetBeans-style GUI

    Thanks for your reply copeg, I will try to as from your suggestions.

    Susie

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: NetBeans-style GUI

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default 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)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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.

  8. #8
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: NetBeans-style GUI

    Thank you both for your suggestions

Similar Threads

  1. New to NetBeans
    By _lithium_ in forum Java IDEs
    Replies: 0
    Last Post: March 1st, 2011, 08:48 PM
  2. Noob that needs some clearing up with Java style programming
    By looneylu in forum Java Theory & Questions
    Replies: 3
    Last Post: January 23rd, 2011, 11:27 PM
  3. Trying to achieve Movie Style Rolling Credits
    By javanoob123 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 10th, 2011, 08:02 PM
  4. Netbeans help
    By [Kyle] in forum Java IDEs
    Replies: 2
    Last Post: September 20th, 2009, 06:32 PM