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
[catch] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2210)
>----- /Error Message -----<
This looks like form editor problem. Reassign if I am wrong.
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":
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.
Please, what does it mean:
> ... after a view starts the class disappears ... ??
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.
not "a view runs" but "a few runs"
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...
I made a "build"... and i added something. But why i can't add it to
the form again?
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
Please try in Tools | Option -> Component Palette -> DrawPanel to set
property "isContainer" to false. And run IDE with the following flag:
Maybe we'll see more then...
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.
Thanks for the log. Now I have a question:
Is the DrawPanel even JavaBean? I.e. does it have an empty public
If the answer is yes, could you send it to me so I could reproduce
somehow what's happening?
The constructor is not empty but public... i will send you this file
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
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.
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.
*** Issue 19534 has been marked as a duplicate of this issue. ***
Resolved for 3.3.x or earlier, no new info since then -> closing.