X

Geertjan's Blog

  • May 30, 2006

Tabs in NetBeans IDE

Geertjan Wielenga
Product Manager
This is not intuitive at all. Someone had to explain it to me twice. Probably this will be better to demonstrate via Wink or something like that, but I haven't yet learnt how to use those tools. So, this is what you do:

  1. Drag JTabbedPane from Component Palette onto Design View:

  2. Drag JPanel onto JTabbedPane:

  3. Make sure the whole JTabbedPane is selected (and not the JPanel inside of it):

  4. Drag another JTabbedPane until you see the orange dashed outline below:

  5. Then drop it. You'll see the second tab:

  6. Use the handles on the sides of the components to expand the whole lot to create some more room for yourself:

  7. Select the first tab. Then make sure that the JTabbedPane is selected, as shown in step 3 above. Now drag the third JTabbedPane until you see the orange dashed outline again:

  8. Then drop it and you'll have three tabs:

Join the discussion

Comments ( 22 )
  • Geertjan Tuesday, May 30, 2006
    OK, step 3 isn't really necessary. But the unintuitive parts are that you need to KNOW that you need to create a JPanel and that you need to KNOW that you need to see the orange dashed outline, otherwise you won't create a tab.
  • christian Tuesday, May 30, 2006
    Damn, this was too late for me :(
    I just made it by editing the form file :(
    Nonetheless, great hint!
  • Curt Cox Tuesday, May 30, 2006
    "4. Drag another JTabbedPane until you see the orange dashed outline below:"
    Don't you mean another JPanel?
  • Geertjan Tuesday, May 30, 2006
    Curt, nope... Only for the first JTabbedPane do you need to drag a JPanel. Subsequent JTabbedPanes do not require a JPanel. Unintuitive? Possibly...

    Christian, thanks for liking the tip and hope you can make use of it next time!

  • Frank Beullens Tuesday, May 30, 2006
    Yeah, this is where i went wrong the first time. Normally you have to place JPanels on the tabbedpane, but when you try this, the first one works, the second one does nothing! A small bug?
    Thanks for the tip.
  • Keith Powell Friday, June 2, 2006
    You don't have to add additional JTabbedPanes to the first JTabbedPane. Just keep adding JPanels. You still have to see the orange dashed outline when you add subsequent JPanels.
  • YOMI Monday, November 19, 2007

    Hi,

    I tried it exactly as u suggested but it failed.

    But i got this

    http://www.netbeans.org/kb/articles/netbeans-hacks-2.html#jtabbedpane (this worked well)

    So instead of adding new JTabbs... i added new JPanels and Jtabs were created automatically.

    Ur method will succesfully create jtabbs but when it comes to adding new swing components, it keeps on creating a new tab for every new component.

    Thanks


  • dreamer_ Friday, April 4, 2008

    instead of nesting JTabbedPanes just right click on first JTabbedPane, then select 'Add from Palette' and find Panel that u want to see in next tab


  • sunpack Monday, March 30, 2009

    Man Thanks, yes not intuitive at all :)

    Thanks a lot


  • grotfang Tuesday, January 26, 2010

    Thanks for the tip. I was completely stumped by this, and was going to edit it by hand, until I found this page. You have just saved me a considerable amount of time. Cheers!


  • Nishi Tuesday, March 13, 2012

    heloo, this is Nishi, im actually under the process of creating an stand alone app for the college which is actually my project,, so im finding it difficult in the gui designing part ,, especially using the tab options ,,

    so if u could give me some tips on the working and using things it would be helpful,,


  • guest Wednesday, June 20, 2012

    Thanks GreetJan.. this was helpful.

    What I done was

    I added JTabbedPane and then JscrollPanel and then JTable.

    second JscrollPanel again to JTabbedPane so on so forth..

    However your blog gave me hint thanks


  • guest Wednesday, December 12, 2012

    Worked perfectly. Thanks.


  • guest Sunday, October 13, 2013

    Thanks (after almost 7 years and still useful)


  • Alex Tuesday, October 22, 2013

    And then how do you delete one of the tab panel ?

    When I right-click tab panel and then choose 'Delete' from the context menu, the entire tab control is removed...


  • guest Tuesday, January 14, 2014

    thanks a lot


  • guest Saturday, March 8, 2014

    You said to add the 2nd JtabbedPane we need to select the first JtabbePane

    and then drop 2nd JtabbedPane into it,when i did so and tried to add new component in the 2nd jatabbedpane a new pane gets created.

    Actually to create 2nd jtabbedpane we need to drop new jpanel after selecting the first jtabbedpane.This works fine.


  • Nitish Saturday, March 8, 2014

    To create 2nd jtabbedpane we need to drag and drop jpanel after selecting

    the first jtabbedpane.


  • Ramesh Sunkara Friday, April 25, 2014

    It was very helpful thank you very much.


  • guest Monday, May 12, 2014

    Thanks alot its really helpfull.It solves my problem


  • rooting Saturday, May 24, 2014

    Thanks :)


  • Binoy Thomas Thursday, October 6, 2016

    Thanks, that was extremely useful and easy to follow.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.