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.
I want to create a custom JavaBean container, it's very simple, think at a JTabbedPane whithout the tab ... ok a JPanel with a fixed layout manager CardLayout. Every time I add the container from the editor this method "org.netbeans.modules.form.layoutdesign.support.SwingLayoutBuilder.creat eLayout" change my layout to GroupLayout. Why ? i set the bean property isContainer to TRUE and containerDelegate method name but the editor ignore it. is there an example ? it's possibile to specify a constraint for dropped component ? thanks
Your setup is correct. Known layout in a container is always changed to GroupLayout so the user does not need to change it manually (i.e. deal with layout managers). That's quite important and we need to preserve this behavior. However, I understand that in some cases the container might want to "insist" on its default layout and basiclally not allow to change it. But there is no standard way to recognize such containers. Components like JTabbedPane are enumerated in the GUI builder specifically. Other containers we consider general, i.e. as they can have any layout manager set. There is no clear solution for this. We might either introduce some new attribute for BeanDescriptor, or change layout to GroupLayout only for Swing components, not for custom subclasses. Neither is perfect... At least we should make it easy to reset the container's layout to the default (issue 72293).
OK, I'undestand the problem but at least it's possible to verify if the layout manager of the JPanel (for example) is different from the default (FlowLayout) leave the layout manager as is ?
You mean we should compare the container's layout with default layout of the first Swing superclass (typically JPanel, so FlowLayout) and not change it if it is different? That's probably better idea than to change only Swing components. I'll consider it.
*** Issue 88671 has been marked as a duplicate of this issue. ***
This was improved as part of a bigger fix: http://hg.netbeans.org/jet-main/rev/1196c3966367 The GUI builder now does not change the layout manager of custom containers (unless it is a JPanel subclass with default FlowLayout). It is also possible to change the layout back to default (initial) - marked in the Set Layout menu, even in case it is an unknown (unsupported) layout manager.
Integrated into 'main-golden', will be available in build *201211080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/1196c3966367 User: Tomas Pavek <tpavek@netbeans.org> Log: #215528, #212792, #80042, #70683: improved handling of custom layouts, incl. unknown, also allowing to set default layout, plus some other fixes