This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to get system font? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to get system font?" Watch "how to get system font?" New topic
Author

how to get system font?

Sanjeev Charla
Ranch Hand

Joined: Apr 02, 2009
Posts: 90

how to obtain native system font ??
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10486
    
    9

GraphicsEnvironment#getAllFonts
GraphicsEnvironment#getAvailableFontFamilyNames


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Sanjeev Charla
Ranch Hand

Joined: Apr 02, 2009
Posts: 90

Yes,
but how to know the present system font in use?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10486
    
    9

That would depend on the LAF and the component being used.
You can retrieve it using UIManager.get("Label.font");
Sanjeev Charla
Ranch Hand

Joined: Apr 02, 2009
Posts: 90

thank you,
from a existing component, i get system font by getFont() with out assigning a custom font to that component.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get system font?