facebook

Adding Tabs to a JTabbedPane

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #270119 Reply

    Ladies and Gents :

    Currently use Matisse to create a JTabbedPane in a JInternalFram.

    How do you create tabs visually? Somehow I was able to add one tab by dragging
    a JPanel and droping it on the Tabbed Pane. However when I try to add the second or Nth
    panel to tabbed pane using right-click context menu and “Add From Palette” options
    I get the folloeing exception

    java.lang.NullPointerException
    at org.netbeans.modules.form.layoutdesign.support.SwingLayoutBuilder.createLayout(SwingLayoutBuilder.java:121)
    at org.netbeans.modules.form.layoutdesign.support.SwingLayoutBuilder.setupContainerLayout(SwingLayoutBuilder.java:74)
    at org.netbeans.modules.form.VisualReplicator.setupContainerLayout(VisualReplicator.java:734)
    at org.netbeans.modules.form.VisualReplicator.cloneComponent(VisualReplicator.java:670)
    at org.netbeans.modules.form.VisualReplicator.createClone(VisualReplicator.java:171)
    at org.netbeans.modules.form.VisualReplicator.addComponent(VisualReplicator.java:329)
    at org.netbeans.modules.form.VisualReplicator.updateAddedComponents(VisualReplicator.java:311)
    at org.netbeans.modules.form.FormDesigner$FormListener.run(FormDesigner.java:1966)
    at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:94)
    at org.openide.util.Mutex.doEventAccess(Mutex.java:1172)
    at org.openide.util.Mutex.readAccess(Mutex.java:209)
    at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:76)
    at org.netbeans.modules.form.FormDesigner$FormListener.processEvents(FormDesigner.java:1898)
    at org.netbeans.modules.form.FormDesigner$FormListener.formChanged(FormDesigner.java:1868)
    at org.netbeans.modules.form.FormModel.fireEvents(FormModel.java:979)
    [catch] at org.netbeans.modules.form.FormModel$EventBroker.run(FormModel.java:1079)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    Any ideas ?

    Chris

    #270150 Reply

    Riyad Kalla
    Member

    Chris,
    You can try selecting the tabbed pane, right-clicking on it, going to Add From Palette, and selecting another JPanel from there to add another tab.

    Also note, that the name of the tabs is a property on the JPanel’s themselves, down in the “layout” section.

    #270179 Reply

    Paul Wade
    Member

    @support-rkalla wrote:

    Chris,
    You can try selecting the tabbed pane, right-clicking on it, going to Add From Palette, and selecting another JPanel from there to add another tab.

    It’s possible that I misread the original post, but it sounds like that’s exactly what he did to get the exception in the first place.

    I’m also having the exact same issue. Right clicking on the tabbed pane and adding from pallet results in a null pointer exception.

    However, if I select the JPanel from the pallet and hover it over the edge of the tabbed pane until the existing JPanel appears to be highlighted and then drop it, it adds it to the tabbed pane.

    #270180 Reply

    Paul Wade
    Member

    Actually, I just noticed that the highlight turns into a dotted line around the JPanel that has already been added.

    #270181 Reply

    Riyad Kalla
    Member

    pwade,
    You are exactly right… sorry about that guys. Originally I thought he was DnD’ing the panel inside the new panel instead of a new tab (as you pointed out pwade, you have to DnD to the edge of JTabbedPane)… but I can reproduce this now, using Add From Palette throws exception.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Adding Tabs to a JTabbedPane

You must be logged in to post in the forum log in