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 15137 - NullPointerException when adding a personal class-file to a form
Summary: NullPointerException when adding a personal class-file to a form
Status: CLOSED INVALID
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P1 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-09-05 09:37 UTC by Niels Fallenbeck
Modified: 2003-06-30 18:28 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Fallenbeck 2001-09-05 09:37:55 UTC
When adding a personal class file to the component palette and later wants to 
add it into a form (in GUI-Editor), a java.lang.NullPointerException occurs.

>----- Error Message -----<
Wed Sep 05 10:32:41 CEST 2001: 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 java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2451)
[catch] 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:914)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        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)
>----- /Error Message -----<
Comment 1 Jan Lahoda 2001-09-05 09:59:45 UTC
This looks like form editor problem. Reassign if I am wrong.
Comment 2 Niels Fallenbeck 2001-09-05 10:35:04 UTC
additional information:
if you just add your class-file, all is okay... the auto-generated 
code looks like eg:
drawPanel1 = new com.medianetcom.schedulermonitor.DrawPanel();

I just edited an option at the properties-menu (submenu "Code 
Generation") the field "Custom Creation Code":
new com.medianetcom.schedulermonitor.DrawPanel(this);

after this, everything seems to be fine. but after a view starts the 
class disappears and every try to add it again results in the 
Exception described above.
Comment 3 Tomas Pavek 2001-09-05 10:42:41 UTC
Please, what does it mean:
> ... after a view starts the class disappears ... ??
Comment 4 Niels Fallenbeck 2001-09-05 10:46:39 UTC
Bad english, i know.

I built an applet and added the public class (DrawPanel) into a 
jScrollPane. After a view runs of the program the class DrawPanel is 
deleted in both GUI-Editor and the file-system-diagram.
When trying to readd it, the error appears.
Comment 5 Niels Fallenbeck 2001-09-05 10:49:15 UTC
not "a view runs" but "a few runs"
Comment 6 Tomas Pavek 2001-09-05 11:06:07 UTC
DrawPanel class must be accessible if you want to add it to the form. 
If the there is not the class then it cannot work.

I wonder how it could be deleted (disappeared)? Didn't you make some 
changes in it, or invoke some "Clean All" or "Compile All" action on 
the package? I don't know how else could it be deleted...
Comment 7 Niels Fallenbeck 2001-09-05 11:34:24 UTC
I made a "build"... and i added something. But why i can't add it to 
the form again?
Comment 8 Tomas Pavek 2001-09-05 11:55:37 UTC
I don't know. Does this problem - that DrawPanel can be added to the 
form, but not again later - does it happen without restarting the IDE 
meanwhile?

Please try in Tools | Option -> Component Palette -> DrawPanel to set 
property "isContainer" to false. And run IDE with the following flag:

runide -J-Dnetbeans.debug.exceptions=true

Maybe we'll see more then...
Comment 9 Niels Fallenbeck 2001-09-05 12:14:41 UTC
It's independent wheter NetBeans has been restarted or not...
When I set isContainer = false I can add it to the form again. But 
when I try tu change the properties with a right-Click to the 
component, another NullPointerException occurs.

I sent you the debug output by mail.
Comment 10 Tomas Pavek 2001-09-05 12:53:39 UTC
Thanks for the log. Now I have a question:
Is the DrawPanel even JavaBean? I.e. does it have an empty public 
constructor?

If the answer is yes, could you send it to me so I could reproduce 
somehow what's happening?
Comment 11 Niels Fallenbeck 2001-09-05 13:00:41 UTC
The constructor is not empty but public... i will send you this file 
via email.
Comment 12 Tomas Pavek 2001-09-05 15:27:22 UTC
Well, that's it - the class MUST have an empty public constructor. 
Otherwise, it is not possible to create an instance of it, not even 
to add it to the form. This is an essential request on JavaBeans.

So please create an empy public constructor for the DrawPanel which 
enables using it for visual design. You may left the custom creation 
code, which takes effect at runtime. Let me know if it helps.

But this is also a problem in NetBeans (Form Editor) - there is no 
notification of "illegal" beans, moreover even no failure detection 
in this case. I thought this worked... :-((
This will be definitely fixed in NB 3.3. See also issue 14223.

I'm marking this issue as INVALID - as the problem is not caused by 
Form Editor.
Comment 13 Niels Fallenbeck 2001-09-06 10:15:40 UTC
I worked another variant like to told me earlier... I set this 
isContainer value to false and added my public code by using the 
component inspector... I told you if I right-click to the 
exploreritem of the drawPanel a NullPointerException occurs. Using 
the Object Browser has very interesting effects.
All values of the property-submenu (background, border, foreground, 
tooltexttip in "Properties" and actionMap, alignmentX and so on 
in "Other Properties") are "<java.lang.NullPointerException>"... but 
adding your personal code has the desired results... bug or feature?
I sent you a screenshot via mail.
Comment 14 Tomas Pavek 2001-09-07 09:13:28 UTC
These NPEs are caused by the fact that there is no instance of the 
bean - because it cannot be created without public empty constructor. 
The only bug in the IDE is that it lets you get so far - you should 
not be able to use such a bean at all. Again - see issue 14223.
Comment 15 Tomas Pavek 2002-01-17 16:18:45 UTC
*** Issue 19534 has been marked as a duplicate of this issue. ***
Comment 16 Quality Engineering 2003-06-30 18:20:20 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 17 Quality Engineering 2003-06-30 18:28:34 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.