Download NetBeans!

20060530 Tuesday May 30, 2006

Tabs in NetBeans IDE

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:

    May 30 2006, 04:52:00 AM PDT Permalink

    Trackback URL: http://blogs.sun.com/geertjan/entry/tabs_in_netbeans_ide
    Comments:

    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.

    Posted by Geertjan on May 30, 2006 at 05:03 AM PDT #

    Damn, this was too late for me :( I just made it by editing the form file :( Nonetheless, great hint!

    Posted by christian on May 30, 2006 at 07:21 AM PDT #

    "4. Drag another JTabbedPane until you see the orange dashed outline below:" Don't you mean another JPanel?

    Posted by Curt Cox on May 30, 2006 at 07:53 AM PDT #

    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!

    Posted by Geertjan on May 30, 2006 at 08:02 AM PDT #

    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.

    Posted by Frank Beullens on May 30, 2006 at 11:51 PM PDT #

    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.

    Posted by Keith Powell on June 02, 2006 at 12:25 PM PDT #

    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

    Posted by YOMI on November 19, 2007 at 12:02 PM PST #

    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

    Posted by dreamer_ on April 04, 2008 at 04:25 AM PDT #

    Man Thanks, yes not intuitive at all :)

    Thanks a lot

    Posted by sunpack on March 30, 2009 at 03:34 PM PDT #

    Post a Comment:

    Name:
    E-Mail:
    URL:

    Your Comment:

    HTML Syntax: NOT allowed