aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes FontMetrics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "FontMetrics" Watch "FontMetrics" New topic
Author

FontMetrics

kumar mars
Ranch Hand

Joined: Jun 04, 2001
Posts: 34
hai
are the changes in the font automatically get reflected in the FontMetrics object or should get the instance again

in the paint mathod i am displaying multilingual text and using FontMetrics object to get the properties of the text like width.
whenever there is a change in font i am indicating it as g.setFont()
should i use g.getFontMetrics() method to update the FontMetrics object or will be automaticatically updated
expecting an early reply
bye


<BR>
george justin
Greenhorn

Joined: Jul 31, 2001
Posts: 25
Hi Kumar
I think FontMetrics Object gets updates automatically for that particular component, u can get the instance of FontMetrics from
Font f = new Font("","","");
getFontMetrics(f); at any point of time
method of the component class, no need to get instance from the graphics class
Cheers
George Justin

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: FontMetrics