Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drawing an oval

 
Arthur Donting
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50239
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Insert this line after what you show as line 11 and before what you have as line 12That might help.
 
Arthur Donting
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
very well... know wher's the problem. but what to do next? how make this object not null?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50239
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic