This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
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 ]