Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default multiple panes problem

    hi guys and gals,

    what i have so far are three tabs containing different things. what i want to do is instead of a user having to press the tab i would like to use three large buttons, which when pressed brings up the chosen content in a central window, without the use of tabbed panels. how would i go about this what swing component would be best for this?

    i tried with layered panes but it ended up getting quite messy.

    thanks,

    L
    Last edited by grease_monkey1986; 05-09-2010 at 01:03 PM.

  2. #2
    Join Date
    Apr 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote Originally Posted by grease_monkey1986 View Post
    hi guys and gals,

    what i have so far are three tabs containing different things. what i want to do is instead of a user having to press the tab i would like to use three large buttons, which when pressed brings up the chosen content in a central window. how would i go about this what swing component would be best for this?

    i tried with layered panes but it ended up getting quite messy.


    |--------------------------------------------|
    ----------------------
    | [form1 button] | | |
    window - changes
    | [form2 button] | depending on | |
    the button pressed
    | [form3 button] | | |
    ---------------------
    |--------------------------------------------|

    thanks,

    L
    Again, posting a small compilable example of what you're trying to do would help us to help you.

    Anyway, if you want to activate one of your three tabs when a button is pressed (although I don't see a reason to do that, the tab will be activated if the user clicks on it, but whatever...), the solution is again the same: create three ActionListeners, and add each one to one of the buttons. Each of the three ActionListeners will activate one of the tabs (so for example, create FirstTabActionListener that activates the first tab and add it to the button that the user should click to activate the first tab; do the equivalent for the remaining two listeners, buttons and tabs).

    Alternatively, if you're not using tabs, do the same but instead of activating a tab, each of the ActionListeners should create a JPanel that holds all the GUI components that you want to show when the button associated to the ActionListener is pressed, and set that JPanel as the ContentPane of your JFrame.

Similar Threads

  1. Problem while using the multiple panels in swings
    By anand206 in forum AWT / Swing
    Replies: 3
    Last Post: 03-23-2010, 04:33 PM
  2. Layered Panes
    By teckno101 in forum AWT / Swing
    Replies: 1
    Last Post: 10-03-2009, 11:16 PM
  3. panes, frames and ddm's :|
    By skatefreak in forum New To Java
    Replies: 1
    Last Post: 08-09-2009, 10:21 AM
  4. GUI Help(Layered panes, opacity, events)
    By xcallmejudasx in forum New To Java
    Replies: 1
    Last Post: 04-29-2009, 11:11 PM
  5. Two content panes in one GUI?
    By Leprechaun in forum New To Java
    Replies: 1
    Last Post: 01-31-2008, 04:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •