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 238382 - Exception while opening Design-Tab of GUI-Form (JFrame)
Summary: Exception while opening Design-Tab of GUI-Form (JFrame)
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.4
Hardware: PC Windows 7 x64
: P2 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 237215 238981 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-14 16:48 UTC by JayChristopher
Modified: 2013-12-16 17:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (323.55 KB, text/plain)
2013-11-14 16:48 UTC, JayChristopher
Details
The GUI-Form-XML-File wich crashed (34.05 KB, application/xml)
2013-11-15 12:14 UTC, JayChristopher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description JayChristopher 2013-11-14 16:48:08 UTC
Product Version = NetBeans IDE 7.4 (Build 201310111528)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_25
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.25-b01

Just tried to open a Swing-GUI-Form (JFrame), but it doesn't open!
When clicking on the "Design"-Button next to the "Source" and "History"-Button, you shortly see the GUI-Builder loading (a light-gray space with text "loading..."), but then it cancels and just shows the source-code Tab.

Details about the form:
- It uses Free-Layout/GroupLayout, except from two panels using GridBagLayout
- There are many buttons which don't have default size, but are horizontally resizable
- Inside of the two Panels with GridBagLayout, there are a custom components calles "ImageLabel" (but the IDE-Log does not show any of my classes in the stacktrace, so I don't assume it's my class which causes the error)

The IDE-Log says something about a NullPointerException at org.netbeans.modules.form.layoutsupport.LayoutSupportManager.getComponentCount

Note:
When opening the same file with NetBeans 7.2.1, it works fine
Comment 1 JayChristopher 2013-11-14 16:48:19 UTC
Created attachment 142194 [details]
IDE log
Comment 2 Tomas Pavek 2013-11-14 18:37:16 UTC
The exception in the log is the bug. The layout of some container was not initialized properly (which may or may not be a significant problem), but the loading should not fail on that. Due to this exception the original problem could not be even reported and the whole form loading crashed.

Could you attach here the GUI form where it fails so we have a sample for verification? And also a sense how frequent issue this can be? Thanks.
Comment 3 JayChristopher 2013-11-15 12:14:50 UTC
Created attachment 142229 [details]
The GUI-Form-XML-File wich crashed

This is the GUI-XML-File which causes the FormBuilder to Crash.
It is called "StartFenster" ("Fenster" is the german word for "Frame"), and it contains the main menu of my application (which is a little card-game, by the way).

As already said, it contains many buttons and labels, two custom components of class "ImageLabel", which are both embedded in Panels with GridBagLayout.
Comment 4 Tomas Pavek 2013-11-15 15:50:08 UTC
In the attached form there is some problem with the reusable.ui.navc.NavigationController custom component (in the form it is saved as an empty container, subclass of JLayeredPane). Due to this problem the layout of the container is not initialized and because of the bug the loading crashes without reporting the problem. I could reproduce it because I don't have reusable.ui.navc.NavigationController class - so for me the problem was that this class was missing. I'd guess it is most likely also the case for the reporter - so please make sure this class is available on classpath, either in a JAR or if as a source in a project then make sure it is compiled (the project built). I've created a similar custom subclass of JLayeredPane and could open the form.

Let me know this workaround does not help.

Fix:
http://hg.netbeans.org/jet-main/rev/a371db95435a

The problem with this bug is that it effectively hides reporting of form loading problems if there is some problem with a custom container (like class not found) so the user does not know what is wrong. So would be nice to have it fixed in a 7.4 patch (if there is some more to go). Luckily it does not affect reporting errors about components that are not containers which is much more frequent case.
Comment 5 JayChristopher 2013-11-16 17:16:16 UTC
So, I rebuilt the Project in case that the class reusable.ui.navc.NavigationController was not compiled, but this didn't resolve the problem either.
I'm quite sure there's no error inside of my NavigationController class cause if I open the same project in NetBeans 7.2.1, opening the form works fine. (Additionaly I'm using the same class NavigationController in some other projects, also embedded inside a form like in this one and it works).

If you want me to upload reusable.ui.navc.NavigationController, I could do this, but it depends on various other classes (not only NavigationControllerDelegate and NavigationBar, but also a complete Animtion-Framework)
Comment 6 Tomas Pavek 2013-11-18 18:17:22 UTC
Changing back to fixed. What remains is only to find a workaround for 7.4 - going to e-mail with the reporter separately.
Comment 7 Tomas Pavek 2013-12-05 14:37:35 UTC
*** Bug 238981 has been marked as a duplicate of this bug. ***
Comment 8 Tomas Pavek 2013-12-05 17:17:02 UTC
Fix transplanted to release74 branch: http://hg.netbeans.org/releases/rev/4b456df6499b
Comment 9 Quality Engineering 2013-12-06 01:02:01 UTC
Integrated into 'releases/release74', will be available in build *201312052201* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/4b456df6499b
User: Tomas Pavek <tpavek@netbeans.org>
Log: #238382: if layout initialization failed (e.g. unknown container class) don't ask LayoutSupportManager for anything, also make old JLayeredPane support load as null layout even if container can't be created
(transplanted from a371db95435abb203a514d3d72fc6bf54bf2cd28)
Comment 10 Tomas Pavek 2013-12-16 17:42:40 UTC
*** Bug 237215 has been marked as a duplicate of this bug. ***