Problems drawing shapes on JPanel (NullPointerException)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Problems drawing shapes on JPanel (NullPointerException)

  1. #1
    Join Date
    Aug 2003
    Posts
    1

    Problems drawing shapes on JPanel (NullPointerException)

    I have a newbie question I hope someone can help me with. I'm writing an application that (among other things) will draw a shape on a JPanel based on a selection from a JComboBox. My code compiles but I get the following error message when I try to run the application. (The application window displays but most of the fields and buttons do not.)

    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at DrawingPanel.paintComponent(DrawingPanel.java:33)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)

    etc.

    I'm attaching most of the relevant code (the application is still a work in progress but the code to display some of the various shapes is in place).

    Any help is much appreciated!
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2003
    Posts
    834

    Thumbs down

    When you post code, it kinda helps if it'll actually compile:
    Code:
    Oval.java:16: Oval should be declared abstract; it does not define draw(java.awt.Graphics2D) in TwoD
    public class Oval extends TwoD {
           ^
    You don't fulfill the 'TwoD' interface in the 'Oval' class.
    ArchAngel.
    O:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center