• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null pointer again!

 
Syamsul Hussin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I really dont know why null pointer is thrown in this code:-

the program is supposed to display a fill oval with color according to the selection made by user from the checkbox. the graphics object for canvas seems to be the problem again, although this time i've put it this way:-

The exception thrown is:-
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to get the Graphics context of something that hasn't even been displayed yet. Move the code to get the Graphics context to after where you display the frame.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Syamsul,
He dude, you had the same problem here null pointer?. Haven't you ever heard the saying Once bitten, twice shy?
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic