Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cant access graphics

 
chanakya nani
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator






i'm getting an error that "

"Exception in thread "main" java.lang.Error: Unresolved compilation problems:
paintComponent cannot be resolved to a type
paintComponent cannot be resolved to a type

at oval.main(oval.java:8)"
 
Rob Camick
Ranch Hand
Posts: 2608
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paintComponent() is a "method", not a "class". You can't create an instance of it.

I suggest you read the section from the Swing tutorial on Custom Painting.

Also, use the "code tags" when posting code so the code retains its formatting and is readable.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote: . . . Also, use the "code tags" when posting code so the code retains its formatting and is readable.
since he's new, I'll do that, and we can see how much better the post looks.
chanakya nani, welcome to JavaRanch

I would advise you not to use an IDE at this stage; get used to a decent text editor and write the GUI code by hand. Also get used to the Oracle/Sun compiler's error messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic