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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getGraphics" Watch "getGraphics" New topic


kumar mars
Ranch Hand

Joined: Jun 04, 2001
Posts: 34
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

Kris Philippaerts

Joined: Oct 19, 2001
Posts: 25
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.
I agree. Here's the link:
subject: getGraphics
It's not a secret anymore!