File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes graphics beginner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "graphics beginner" Watch "graphics beginner" New topic

graphics beginner

preethi george

Joined: Feb 10, 2009
Posts: 6
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

Joined: Mar 22, 2005
Posts: 39547
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.

Ping & DNS - updated with new look and Ping home screen widget
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36478
Since this is a Swing-related question I shall move it to the Swing forum.
jQuery in Action, 2nd edition
subject: graphics beginner
Similar Threads
Paint & Applet/HTML
No Use of Applet ???
Saving a Jpanel as a JPEG
why is the method not getting executed??
HTML graphics in web apps