[ajug-members] change system's font in Swing/AWT

Tim Scott tscott at WilsonLLP.com
Mon Jun 13 13:56:39 EDT 2005


I believe you're tense is all incorrect!

________________________________

From: ajug-members-bounces at ajug.org
[mailto:ajug-members-bounces at ajug.org] On Behalf Of David Fitzhenry
Sent: Sunday, June 12, 2005 3:41 PM
To: General AJUG membership forum (100-200 messages/month)
Subject: Re: [ajug-members] change system's font in Swing/AWT


I believe the best way is to iterate through the UIManager default
settings.  There might be an easier way, but in my searches, this was
the one that worked best.  This method might help:

private void setUIFont(javax.swing.plaf.FontUIResource f) {
        java.util.Enumeration keys = UIManager.getDefaults().keys();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);

            if (key == "Menu.font" || key == "MenuItem.font") {
                    if (value instanceof
javax.swing.plaf.FontUIResource) {
                        UIManager.put(key, new
FontUIResource(UIConstants.TU_FONT_DEFAULT_MENU));
                    }
            } else {
                    if (value instanceof
javax.swing.plaf.FontUIResource) {
                        UIManager.put(key, f);
                    }
            }
        }
    }



On 6/12/05, Chuan Dac Dang < cdang2 at student.gsu.edu
<mailto:cdang2 at student.gsu.edu> > wrote: 

	Guys,
	How to change system's font in Swing? I am working on the GUIs
and I wanna learn more about it. 
	thanks,
	---
	Chuan Dang
	Department of Computer Science
	Georgia State University
	(770) 633 - 7943
	
	
	_______________________________________________
	ajug-members mailing list
	ajug-members at ajug.org
	http://www.ajug.org/mailman/listinfo/ajug-members
	




-- 
thanks, 
- Dave 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ajug.org/pipermail/ajug-members/attachments/20050613/c60c6cd6/attachment.html 


More information about the ajug-members mailing list