Results 1 to 14 of 14

Thread: Tabbed pane

  1. #1
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default Tabbed pane

    hey there, I want to create multiple tabbed pane i mean if user clicks on a button den a new tabbed pane shud be created for eg: in MS Excel we create as many new sheets as we want that kind of mechanism i want 2 implement in my application.its like user can create a new tab jus by clicking a button.
    pls help.

  2. #2
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    i thought of using JTabbedPane or CardLayout .

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Either JTabbedPane or CardLayout could work depending on whether you want the user to be able to tab back to a previous view.

    Also, welcome to the forum. I request that you avoid using non-standard abbreviations here as it may make your questions difficult to interpret, especially for folks here for whom English is not a primary language.

    Best of luck and again welcome!

  4. #4
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    thanks for the quick reply."abbreviation" thing i will keep that in mind.
    I didnt get "to be able to tab back to a previous view" .i mean we can anytym (sorry anytime) click on any tab. ok i m confused with -do i hav to create a new tabbed pane or card layout every time a user click a button because i want the same initial view of every new tab created. i dont know whether i m making sense or not bt pls tell me.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    What you do depends on what you want your GUI to do. If you want a a JTabbedPane showing several tabs and want to give the user the ability to click on a tab and show a different JPanel, then use a JTabbedPane. Otherwise if you want to change JPanels on the click of a JButton, but don't want the user swapping JPanels by clicking on tabs, then use CardLayout.

    If you're still having problems, you may wish to create a small compilable runnable GUI that does nothing but creates new JPanels on button push, and then post this code here. We can then work with you on this code. This is called creating an SSCCE.

    You would probably need only one JTabbedPane or CardLayout object, but would be creating new tabs or "cards" respectively.

  6. #6
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    After u asked me to create an SSCCE , i started creating one but when writing event for button i realized that i m confused with how to make multiple tabs or JPanels as per the user requirements.I mean how to make multiple panel or tabs with all the functionality which its previous tabs have and I m pretty much sure that i need to create new multiple tabs.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by sonal12 View Post
    After u asked me to create an SSCCE , i started creating one but when writing event for button i realized that i m confused with how to make multiple tabs or JPanels as per the user requirements.
    To create a JPanel, you'd create a new JPanel object via new JPanel(). The Swing tutorials will show you how to add this to a JTabbedPane or a CardLayout-using container.

    I mean how to make multiple panel or tabs with all the functionality which its previous tabs have and I m pretty much sure that i need to create new multiple tabs.
    I'm not sure I understand you here.

    Perhaps you might want to post what you have so far.

  8. #8
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    I just got what my problem is?? u were right I needed only one JTabbedPane or CardLayout object, but was creating new tabs or "cards" respectively.I m working on it i will let u know the result.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  10. #10
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    hey thanks man u were really helpful. I appreciate ur help and dont worry i will not let u go now . I will cum back with new problem

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    Quote Originally Posted by sonal12 View Post
    hey thanks man u were really helpful. I appreciate ur help and dont worry i will not let u go now . I will cum back with new problem
    Recommended reading : How To Ask Questions The Smart Way

    db

  12. #12
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    oops!!! ok i will read that.

  13. #13
    sonal12 is offline Member
    Join Date
    Sep 2010
    Posts
    8
    Rep Power
    0

    Default

    there is one more problem i m facing:
    (i)on clicking menu item i should get a dialog box
    bt on clicking menu item it opens altogether a new frame and then on that new frame the dilog box is displayed. What could be the problem.

  14. #14
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Your code is doing what you tell it to do, and so you have a bug in your code, one that we can't help you with as we don't have your code. You will either need to debug with a debugger or println statements, or post code.

Similar Threads

  1. add tabbed pane to the frame on a button click
    By Mahaveer in forum New To Java
    Replies: 0
    Last Post: 11-20-2009, 10:19 AM
  2. tabbed Pane .
    By programmer_007 in forum AWT / Swing
    Replies: 2
    Last Post: 09-03-2009, 09:52 PM
  3. JTree and Tabbed Pane
    By paluee in forum AWT / Swing
    Replies: 1
    Last Post: 03-30-2009, 07:03 AM
  4. How to add a jbutton to tabbed pane headder?
    By Melki in forum AWT / Swing
    Replies: 12
    Last Post: 10-15-2008, 09:16 PM
  5. Tabbed pane using struts 2.x......?
    By prabhurangan in forum Web Frameworks
    Replies: 1
    Last Post: 07-19-2008, 07:48 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
  •