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 72203 - "Add from palette" of a JPanel to a JPanel leads to NullPointerException when in Free Design
Summary: "Add from palette" of a JPanel to a JPanel leads to NullPointerException when...
Status: RESOLVED DUPLICATE of bug 71250
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-03 09:23 UTC by gvezzelli
Modified: 2006-02-08 18:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace and messages.log extract (6.61 KB, text/plain)
2006-02-03 09:24 UTC, gvezzelli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gvezzelli 2006-02-03 09:23:22 UTC
I've repeated the error following these steps :

1) Create a new JInternalFrame with "New... -> JInternal Form ...".
2) Work in Free design.
3) Add a JPanel (jPanel1) to the JInternalFrame.
4) Set jPanel1 layout to CardLayout
5) Right click jPanel1, select "Add from Palette... -> Swing -> JPanel"

When I click JPanel, a NullPointerException is thrown.

I verified that if I set a layout in the JInternalFrame (AbsoluteLayout, for 
example), the NPE is not thrown - ONLY when working in Free Design mode.
Comment 1 gvezzelli 2006-02-03 09:24:21 UTC
Created attachment 28730 [details]
Stack trace and messages.log extract
Comment 2 gvezzelli 2006-02-03 09:37:30 UTC
I verified that this happens with JFrame too, and not only with CardLayout but 
also with the other layouts. The steps are the same.
Comment 3 cbulcu 2006-02-03 16:54:26 UTC
I verified it, and yes it's a NPE. But NB doesn't show it. It write it down into
the log file.
Comment 4 Marek Grummich 2006-02-05 16:56:48 UTC
Seems to be similar/duplicate of #71937, Honza, Tomas?
Comment 5 cbulcu 2006-02-05 17:04:08 UTC
If it was fixed, why wasn't it integrated into final release?
Comment 6 Tomas Pavek 2006-02-06 09:39:05 UTC
Looks like same as issue 71250. The fact it happens also with CardLayout is
unpleasant. The workaround is a bit more complicated than with JTabbedPane.
Having known this we'd push the fix into 5.0...

*** This issue has been marked as a duplicate of 71250 ***
Comment 7 cbulcu 2006-02-06 09:42:50 UTC
It happens with BorderLayout too. It must be investigated with other layouts
too. On my system, the error message wasn't showed, but it was saved into the
log file.
Comment 8 Tomas Pavek 2006-02-06 10:34:06 UTC
It happens with all layout types and containers except free design. It means you
can't add a panel to these containers via the context menu Add From Palette.
However you can always add the panel directly from the palette via mouse. In
some cases (like if having CardLayout in the container) it is a bit difficult -
when the first added subpanel occupies the entire container then the next go
into this subpanel instead of the parent container. In such case there are two
possible workarounds:

* move the subpanel to the right container subsequently in the Inspector (by
dragging the node)

* or set the container layout to another layout (FlowLayout, GridLayout, etc)
for adding, then change the layout back (to CardLayout) when done
Comment 9 suryad 2006-02-06 16:46:31 UTC
Why is it marked resolved if this is a very prevalent bug still? The mailing 
list gets these kind of bugs reported almost every other day!
Comment 10 Tomas Pavek 2006-02-08 18:17:17 UTC
This has been fixed in development trunk and the fix will be available in the
next NetBeans release.