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.
Dev Build 200303132350 When you right-click an existing container to copy and paste it elsewhere, it doesn't work if the container is layed-out using a custom layoutmanager. Works ok with any other "default" layout managers. This used to work on 3.4.1 and before. Steps to reproduce : 1) Install a custom layout manager (I'll include the one I use as an attachment) using the Explorer-right-click-add to component palette-LayoutManagers. This layout manager is now available in the form editor. 2) Design a JPanel, add a JPanel, add stuff in it. 3) Right-click the JPanel, copy and paste it. Works ok. 4) Change its layout manager to the custom layout manager. 5) Repeat step 3. Nothing happens in the Form editor. No code is generated. Well, *something* happened, but its not apparent : say you JPanel was named "jPanel2", this last copy-paste should have created "jPanel3". Try renaming "jPanel2" to "jPanel3", and you have an error that says that 2 components can't have the same name. Still, this "jPanel3" is nowhere to be found. Keep up the great work, its a pleasure to use NetBeans. Only glad to help hammer down a few bugs.
Created attachment 9413 [details] The custom layout manager I use.
I get following exceptions (printed in console): java.lang.InstantiationException: org.netbeans.modules.form.layoutsupport.DefaultLayoutSupport at java.lang.Class.newInstance0(Class.java:281) at java.lang.Class.newInstance(Class.java:249) at org.netbeans.modules.form.layoutsupport.AbstractLayoutSupport.cloneLayoutSupport(AbstractLayoutSupport.java:753) at org.netbeans.modules.form.layoutsupport.LayoutSupportManager.copyLayoutDelegateFrom(LayoutSupportManager.java:227) at org.netbeans.modules.form.MetaComponentCreator.makeCopy(MetaComponentCreator.java:519) at org.netbeans.modules.form.MetaComponentCreator.copyComponent2(MetaComponentCreator.java:294) ... java.lang.NullPointerException at org.netbeans.modules.form.layoutsupport.LayoutSupportManager.copyLayoutDelegateFrom(LayoutSupportManager.java:230) at org.netbeans.modules.form.MetaComponentCreator.makeCopy(MetaComponentCreator.java:519) at org.netbeans.modules.form.MetaComponentCreator.copyComponent2(MetaComponentCreator.java:294) ...
The immediate problem is in that class org.netbeans.modules.form.layoutsupport.DefaultLayoutSupport cannot be instantiated using Class.newInstance(). There is also architectural flaw behind - it's not taken into account that copying of layout may fail...
Fixed in trunk. /cvs/form/src/org/netbeans/modules/form/layoutsupport/AbstractLayoutSupport.java new revision: 1.37; previous revision: 1.36 /cvs/form/src/org/netbeans/modules/form/layoutsupport/DefaultLayoutSupport.java new revision: 1.4; previous revision: 1.3 Now thinking if this should go to NB 3.5.
Wow, that was fast ! About your comment on if it should go to 3.5 or not, I would say yes because other people like me going from 3.4.1 to 3.5 (when its officially released) will most likely report the problem.... But I understand there are probably a dozens of steps to take to make sure your fix doesn't affect anything else, QA and stuff... Your call. Thanks again, Francis
It would be no problem to put this to NB 3.5 - if it was last week. But now we are already in stage when only P1 bugs ("showstoppers") can be fixed. This is surely ugly bug, P2 at least, but I'm not sure if it is showstopper. Otherwise the fix is quite simple.
Doh ! Oh well.. Maybe we can put something in the release notes about it, or something... There is an easy workaround : just change the layout to a "default" one, like FlowLayout, do the copy, and then put back the desired "custom" layout. Until next bug ;-)
Okay, let's add this to release notes (readme.html): It is not possible to copy/paste containers with custom (i.e. non-standard) layout managers. A workaround is to set the layout e.g. to FlowLayout first, then do the copy, and then set the right layout back again.
adding to the 3.5 readme. Thanks for the text, Tomas.
The issue is not regression, I successfully reproduced it in release 3.4.1 build. Now it works fine with the fix in trunk - verified in dev build #200304150100.
removing RELNOTE keyword