This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to change the font of a whole application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to change the font of a whole application?" Watch "How to change the font of a whole application?" New topic
Author

How to change the font of a whole application?

Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Hi,
Is there a convenient way to change the font of a whole application?
Best
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

The easiest way to do this would be something like this :


However, that means the font for *everything* is changed to the specified font. If you want to change every instance of a font on a type of component, or sometimes even a part of a type of component in your application, take a look at the keys returned from UIManager.getDefaults(). For example, if you only change the font stored for the key "Button.font" then it only changes the font used by JButtons.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
I actually started a Swing app last week that displays the values of everythign in UIManager. It's a quick way to see the colors, fonts, etc that the UIManager has setup. Very handy for finding where a certain color/font/etc is set so you can change it. I currently have it displaying all the colors but was going to add tabs for the other items (like Fonts) and add a way to either change/set the values and a way to be able to change the values in the GUI and have it out put the code you need to make these UI changes in your own code.
Is anyone interested in this? I am going to release it as freeware with source eventually, but if anyone is interested in it now, I'll finish it up ASAP.
brian
[ January 23, 2004: Message edited by: Brian Pipa ]

My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Thank you very much.
 
 
subject: How to change the font of a whole application?
 
Similar Threads
Changing the font size in java GUI
Font in JTextComponent
Swing / JFC / AWT
How to change font properties, of subsection of page.
can we change font or size of a particular column in jtable