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 FontMetrics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "FontMetrics" Watch "FontMetrics" New topic


kumar mars
Ranch Hand

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

george justin

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
George Justin

I agree. Here's the link:
subject: FontMetrics
It's not a secret anymore!