This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246399 - IllegalArgumentException: cannot add to layout: constraints must be a GridBagConstraint
Summary: IllegalArgumentException: cannot add to layout: constraints must be a GridBag...
Status: NEW
Alias: None
Product: apisupport
Classification: Unclassified
Component: Templates (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Martin Kozeny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-12 07:08 UTC by slurp
Modified: 2014-09-02 07:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 211196


Attachments
stacktrace (2.77 KB, text/plain)
2014-08-12 07:08 UTC, slurp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description slurp 2014-08-12 07:08:06 UTC
Build: NetBeans IDE 8.0 (Build 201403101706)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.5-b02, Java(TM) SE Runtime Environment, 1.8.0_05-b13
OS: Windows 8

User Comments:
slurp: Run AbcFileType module from api-samples version 8.0. Open any project. Create new abc file. Open the file, and switch to "Visual" multiview. Then do a drag gesture on the bar where multiview tabs are located. To simplify, do it on the right of "History" multiview tab.

If the getToolbarRepresentation() of the activated multiview (in this case, "Visual") returns null, this error will not occur. But it will trigger another error when we switch between topcomponent in editor view.




Stacktrace: 
java.lang.IllegalArgumentException: cannot add to layout: constraints must be a GridBagConstraint
   at java.awt.GridBagLayout.addLayoutComponent(GridBagLayout.java:708)
   at java.awt.Container.addImpl(Container.java:1125)
   at javax.swing.JToolBar.addImpl(JToolBar.java:580)
   at java.awt.Container.add(Container.java:436)
   at javax.swing.plaf.basic.BasicToolBarUI.setFloating(BasicToolBarUI.java:838)
   at javax.swing.plaf.basic.BasicToolBarUI.floatAt(BasicToolBarUI.java:1022)
Comment 1 slurp 2014-08-12 07:08:11 UTC
Created attachment 148651 [details]
stacktrace
Comment 2 slurp 2014-09-02 06:39:01 UTC
It turns out that the toolbar returned by getToolbarRepresentation() must implement setFloatable(false). Until now I have never seen any usage in Netbeans that requires the toolbar (on MultiViewElement, to be specific) to be floatable.

So I propose the snippet below on org.netbeans.modules.apisupport.project.ui.wizard.loader.templateDataObjectMultiVisual.javx

@Override
public JComponent getToolbarRepresentation() {
        toolbar.setFloatable(false);
        return toolbar;
}