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 19534 - NPE after adding JPanel from Component Palette to JDialog
Summary: NPE after adding JPanel from Component Palette to JDialog
Status: CLOSED DUPLICATE of bug 13038
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: -FFJ-
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-17 15:03 UTC by peterp
Modified: 2003-06-30 18:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
test case (5.46 KB, application/octet-stream)
2002-01-25 10:45 UTC, Tomas Pavek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description peterp 2002-01-17 15:03:13 UTC
1. Create a new Jdialog form, called MyJDialog.
2. Create a new JPanel form, called MyJPanel.
3. Insert a JButton into MyJPanel and set an icon for this JButton.
4. Save and compile MyJPanel.
5. Add MyJPanel to the Component Palette.
6. Try to add the new Component Palette (MyJPanel) into MyJDialog. Out comes 
this exception:

java.lang.NullPointerException: null
java.lang.NullPointerException
        at org.netbeans.modules.form.RADVisualContainer.initLayoutSupport
(RADVisualContainer.java:48)
        at org.netbeans.modules.form.HandleLayer.addVisualBean
(HandleLayer.java:436)
        at org.netbeans.modules.form.HandleLayer.access$1800
(HandleLayer.java:43)
        at 
org.netbeans.modules.form.HandleLayer$HandleLayerMouseListener.mousePressed
(HandleLayer.java:904)
        at java.awt.Component.processMouseEvent(Component.java:3712)
        at java.awt.Component.processEvent(Component.java:3544)
        at java.awt.Container.processEvent(Container.java:1164)
        at java.awt.Component.dispatchEventImpl(Component.java:2593)
        at java.awt.Container.dispatchEventImpl(Container.java:1213)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at 
javax.swing.plaf.basic.BasicInternalFrameUI$GlassPaneDispatcher.retargetMouseEve
nt(BasicInternalFrameUI.java:1221)
        at 
javax.swing.plaf.basic.BasicInternalFrameUI$GlassPaneDispatcher.forwardMouseEven
t(BasicInternalFrameUI.java:1148)
        at 
javax.swing.plaf.basic.BasicInternalFrameUI$GlassPaneDispatcher.mousePressed
(BasicInternalFrameUI.java:1087)
        at java.awt.Component.processMouseEvent(Component.java:3712)
        at java.awt.Component.processEvent(Component.java:3544)
        at java.awt.Container.processEvent(Container.java:1164)
        at java.awt.Component.dispatchEventImpl(Component.java:2593)
        at java.awt.Container.dispatchEventImpl(Container.java:1213)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2451)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2210)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
        at java.awt.Container.dispatchEventImpl(Container.java:1200)
        at java.awt.Window.dispatchEventImpl(Window.java:926)
        at java.awt.Component.dispatchEvent(Component.java:2497)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:131)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:98)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

*** [FFJ CUSTBUG] this bug was submitted by FFJ customer ***

Note: verified in FFJ3.0 builds 020115 and 010817 (FCS one)
Comment 1 Tomas Pavek 2002-01-17 16:18:45 UTC
This looks like MyJPanel cannot be instantiated. Please make sure it 
is really compiled at the time you add it to MyJDialog. Also make 
sure it has an empty public constructor. For test, right click 
MyJPanel in Explorer and choose Customize Bean. If all the conditions 
are fulfilled and you cannot still add MyJPanel to the form, then 
reopen this bug (and provide more details), otherwise this is 
duplicate of issue 15137.

In FFJ 3.0, this is also a problem of bad errors reporting, see also 
issue 14223.


*** This issue has been marked as a duplicate of 15137 ***
Comment 2 Fabien Balageas 2002-01-22 16:20:53 UTC
In fact, MyJDialog is compiled and has an empty constructor, but 
can't be instantiated (via Customize bean, for instance). When i look 
at the Forte's ide.log, i have the following exception:

*********** Exception occurred ************
Tue Jan 22 17:11:53 CET 2002: java.lang.NullPointerException: null
Annotation: Cannot create instance of desired class.
java.lang.NullPointerException
	at javax.swing.ImageIcon.<init>(ImageIcon.java:134)
	at 
com.twinsoft.convertigo.studio.EmulatorViewPanel.initComponents
(EmulatorViewPanel.java:102)
	at com.twinsoft.convertigo.studio.EmulatorViewPanel.<init>
(EmulatorViewPanel.java:46)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:237)
	at org.openide.loaders.InstanceSupport.instanceCreate
(InstanceSupport.java:192)
[catch] at org.openide.actions.CustomizeBeanAction.customize
(CustomizeBeanAction.java:131)
	at org.openide.actions.CustomizeBeanAction.performAction
(CustomizeBeanAction.java:53)
	at org.openide.util.actions.NodeAction.performAction
(NodeAction.java:92)
	at org.openide.util.actions.NodeAction.actionPerformed
(NodeAction.java:83)
	at org.netbeans.core.ModuleActions$1.run
(ModuleActions.java:76)
	at org.openide.util.Task.run(Task.java:124)
	at org.openide.util.RequestProcessor$ProcessorThread.run
(RequestProcessor.java:626)

What's wrong with that?
Comment 3 Tomas Pavek 2002-01-22 16:41:27 UTC
> In fact, MyJDialog is compiled and has an empty constructor, but
> can't be instantiated (via Customize bean, for instance).

Not MyJDialog, but MyJPanel (resp. EmulatorViewPanel)...

From the exception I see now what's the problem, see issue 13038.

*** This issue has been marked as a duplicate of 13038 ***
Comment 4 Fabien Balageas 2002-01-25 07:37:46 UTC
I have noticed that this issue only triggers when i use JButton with 
icon but without text, i.e. if i create a JButton with text and icon, 
i am able to customize bean; but if i delete text, i am not able to 
customize bean any more: i obtain the exception.

The icon is located in a sub directory of my Java package, and i 
choose it via the IDE with the "classpath" option. It is visible when 
designing the panel in the form editor.

I am using Windows 2000, JDK 1.3.1_01 and IDE build 010925.
Comment 5 Tomas Pavek 2002-01-25 10:45:46 UTC
Created attachment 4417 [details]
test case
Comment 6 Tomas Pavek 2002-01-25 10:52:28 UTC
I've created a simple testcase - see the attachment. Create a 
directory and mount it in the IDE. Then unpack the issue19534.zip 
into it. Go to pack1 and MyPanel1 and MyPanel2 to palette (from 
context menu -> Tools -> Add to Component Palette, category beans). 
Then open MyDialog form and try to add the panels to it. MyPanel1 
contains button with icon and without text, MyPanel2 button with both 
icon and text. The icon is placed in subpackage pack2. Also try 
Customize Bean on both panels.

My results: everything works when I run IDE with
-J-Dnetbeans.security.nocheck=true

It does not work without this switch. There's no difference between 
MyPanel1 and MyPanel2. Tried on W2K, JDK 1.3.1, FFJ 3.0 build 010925. 
So for me it looks like issue 13038.

Are you doing something different? Could you try this testcase?
Comment 7 Fabien Balageas 2002-01-25 11:26:07 UTC
Tomas,

I have tested your attachment, mount your test Java files in my 
Forte. Then i have tried to customize bean MyPanel1 and MyPanel2 and 
i have the same results as yours: everything works only when I run 
IDE with -J-Dnetbeans.security.nocheck=true.

Thanks for your help!
Comment 8 Tomas Pavek 2002-01-25 12:16:57 UTC
OK. If you have still any problems using your custom panel bean in 
form and having exceptions ending with:
java.lang.NullPointerException
	at javax.swing.ImageIcon.<init>(ImageIcon.java:134)
...
even with -J-Dnetbeans.security.nocheck=true and the bean itself 
works well out of IDE, then I really don't know what could be wrong. 
In such a case would be nice if could download the lates build of 
NetBeans 3.3.1 form http://www.netbeans.org/release33/index.html and 
try it (everything should work here without any startup switches)...
Comment 9 Tomas Pavek 2002-02-11 16:56:37 UTC
After all, I still think this is issue 13038.

*** This issue has been marked as a duplicate of 13038 ***
Comment 10 Quality Engineering 2003-06-30 18:20:54 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 11 Quality Engineering 2003-06-30 18:29:48 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.