Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

graphics beginner

 
preethi george
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a really silly problem.. but i cant get any help..

i need to initialize a graphics object.. the javadocs mentions create();
cant get it to work and faces a compilation error : cannot find symbol();
could any one tell me the correct syntax??
Graphics g = ??? ;
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't create Graphics objects; AWT/Swing creates them, and then provides them to your code in appropriate places, such as inside of paint or paintComponent methods. You may want to work through the chapter on custom painting in the Sun Java Tutorial.
 
Campbell Ritchie
Sheriff
Posts: 48454
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is a Swing-related question I shall move it to the Swing forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic