aspose file tools*
The moose likes Beginning Java and the fly likes Drawing an oval Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Drawing an oval" Watch "Drawing an oval" New topic
Author

Drawing an oval

Arthur Donting
Greenhorn

Joined: Mar 22, 2009
Posts: 10
hey guys, coud you help me a little?
I need to write a class which draws an oval. here's what i have:



vhen ever i try to run this class i get this error:

Exception in thread "main" java.lang.NullPointerException
at Draw2.oval(Draw2.java:24)
at Draw2.main(Draw2.java:19)


Could any one help me to fix this problem?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39832
    
  28
Insert this line after what you show as line 11 and before what you have as line 12That might help.
Arthur Donting
Greenhorn

Joined: Mar 22, 2009
Posts: 10
very well... know wher's the problem. but what to do next? how make this object not null?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39832
    
  28
Where are you getting the Graphics object from?
Why are you using AWT rather than Swing?
What have you added the Canvas to?
What does it say about nulls in the Component#getGraphics() documentation?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drawing an oval