aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes FontMetrics Object in getInsets() 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 Object in getInsets()" Watch "FontMetrics Object in getInsets()" New topic
Author

FontMetrics Object in getInsets()

Helmut Lerch
Ranch Hand

Joined: Feb 11, 2001
Posts: 48
Hy all,
I need to have a FontMetrics Object in the getInsets() Method. I read that getToolkit().getFontMetrics(Font) is deprecated. How else can I get one?
Because its an similar subject, I ask a second question a second time:
How can I get the default system font?
Thanks for replying
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
How can I get the default system font?
Pl. Check up Font.getFont();
Re the first qstn, I don't getit. Could you pl. elaborate on
what you are trying to do....?
Also, when a method is deprecated, a work-around is generally provided.
regds.
- satya

[This message has been edited by Madhav Lakkapragada (edited March 11, 2001).]


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Helmut Lerch
Ranch Hand

Joined: Feb 11, 2001
Posts: 48
Thanks for Replying,
Originally posted by Madhav Lakkapragada:

Pl. Check up Font.getFont();
Re the first qstn, I don't getit. Could you pl. elaborate on
what you are trying to do....?
Also, when a method is deprecated, a work-around is generally provided.
[This message has been edited by Madhav Lakkapragada (edited March 11, 2001).]

I want to build a Panel with a border and a titlestring in the upper left corner. To ensure correct layout I think i have to change the insets according to the FontMetrics of the selected Font. The FontMetrics question is answered as I found getFontMetrics(Font) in Component (don't know why I first used Toolkit.getFontMetrics(Font)).
The second question arises because getFont() returns null until the Component is visible. getInsets() gets called before the Component is visible. So I need to know which Font will be used when there is no Font explicite specified by calling setFont(Font).
Thanks
pride Jimmy
Greenhorn

Joined: May 05, 2003
Posts: 5
I meet the same problem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FontMetrics Object in getInsets()