Re: Drawing with Extended JPanel Class
Wade Chandler <[email protected]> Tue, 5 Aug 2008 01:50:54 -0700 (PDT)
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
Please use nbusers for such questions next time. nbui is not a general help forum, but is only used to work on the UI of the IDE itself. On your query, the class needs to be either added to the palette and dragged onto the form, or dragged onto the form from the project view, as long as the project whose form is being dragged onto has all the classes being used on its classpath and their dependencies. Then NB will use an instance of your class and its interface versus you using a JPanel and using your instance polymorphically which uses the JPanel interface. *interface = methods and fields provided by the class provided by the variable type Wade ================== Wade Chandler, CCE Software Engineer and Developer, Certified Forensic Computer Examiner, NetBeans Dream Team Member, and NetBeans Board Member http://www.certified-computer-examiner.com http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam http://www.netbeans.org ----- Original Message ---- > From: philju <[email protected]> > To: [email protected] > Sent: Monday, August 4, 2008 12:09:52 PM > Subject: [nbui] Drawing with Extended JPanel Class > > > Hi all, > > I have produced a class that extends JPanel in order to override the paint > method and ensure that an image is painted on the panel following an a call > to the component's repaint() method. The modified paint method includes > conditional code that selects the appropriate colour scheme according to a > configured string option. > > My problem relates to the fact that additional methods to change the string > are inaccessible as the object type is fixed as JPanel with NetBeans and not > my extended class, therefore the colour of the graphic is fixed according to > the value passed as a parameter to the constructor. > > How do I either produce a dynamic process to achieve this functionality with > an existing JPanel in a way that ensures the configured graphic remains on > it following a repaint() or how do I instantiate the object as my extended > class and include it in the GUI code generated by NetBeans so that the > layout of the form is maintained? > > I'm unsure if any code would assist this query, but please let me know if > any is required. > > Cheers, > Phil > -- > View this message in context: > http://www.nabble.com/Drawing-with-Extended-JPanel-Class-tp18814353p18814353.html > Sent from the Netbeans - UI mailing list archive at Nabble.com.