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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getGraphics" Watch "getGraphics" New topic
Author

getGraphics

kumar mars
Ranch Hand

Joined: Jun 04, 2001
Posts: 34
hai
what happens i mean what all the methods invoked when
the methods getGraphics or getFontMetrics are invoked
is it good to use this methods either with in or from out side the paint method
i have to display a text which comprised of differrent fonts
so ihave to change the font and get the instances of graphics and fontMetrics updated how can i do this
hoping a better reply

<BR>
Kris Philippaerts
Greenhorn

Joined: Oct 19, 2001
Posts: 25
Hi,
you realy should try to keep your graphical work inside the paint or the paintComponent method. If not, you might lose graphical data when the component repaints.
You should use the Graphics object, given as a parameter in the paint or paintComponent method and use the setFont(..) method in Graphics to change your font.
HTH,
Kris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getGraphics