Re: Drawing with Extended JPanel Class
Wade Chandler <[email protected]> Tue, 5 Aug 2008 09:41:21 -0700 (PDT)
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
----- Original Message ---- > From: philju <[email protected]> > To: [email protected] > Sent: Tuesday, August 5, 2008 6:09:41 AM > Subject: Re: [nbui] Drawing with Extended JPanel Class > > > Hi Wade, > > Sorry for the mis-posting, I'm new to this forum! Thanks for replying > anyway... > > I thought adding the bean to the palette might be essential, in which case I > have an additional problem... > > Below is the code for my extended JPanel, and currently it resides in the > root - "default package" of the project source folder. I believe I've met > all of the JavaBeans requirements and as such NetBeans registers the class > as a valid bean when attempting add it from the project folder using the > palette manager. I select the bean and the palette category, no message is > generated which leads me to believe the process has been successful. > However, when I access the palette it isn't visible, even following a > refresh. > > Dragging the class from the project navigator onto the form for visual > development doesn't result in anything happening either. Any thoughts? > Does this class have any dependencies in any other JARs or libraries other than Swing? Also, it is now recommended, after Java 1.4, to always use a package as it can cause different issues with different class loaders. Your problem might resolve itself if you don't have any dependencies and move your class into a package. Also, make sure you build the class before you try to drag it from the project window. > Can I also ask if including a second, non empty constructor would violate > the JavaBeans coding convention? It will not. The JavaBeans specification itself doesn't actually enforce the default constructor in text I don't believe, however, with any specification is a reference API, and there are classes in that API (java.beans) which require default constructors to work with JavaBeans, and all other code does this as well, because it is the only easy way for instantiation without some type of bean factory standard or something along those lines. Regardless, as long as the usage of your class by the IDE or other JavaBean tools is not dependent upon this other constructor it is perfectly fine. I do this all the time, and then I can change the initialization code in NB to use my other constructor. >Please let me know if you would prefer I > re-post this in nbusers. > It's fine to finish up here, just please remember in the future. Thanks for the understanding here. Wade