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

Patrick Carroll itspmae at gmail.com
Sun Jun 12 17:34:25 EDT 2005


This may be old-school, but:

public static void setUIFont (javax.swing.plaf.FontUIResource f){
    //
    // sets the default font for all Swing components.
    // ex. 
    //  setUIFont (new javax.swing.plaf.FontUIResource("Serif",Font.ITALIC,12));
    //
    java.util.Enumeration keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
      Object key = keys.nextElement();
      Object value = UIManager.get (key);
      if (value instanceof javax.swing.plaf.FontUIResource)
        UIManager.put (key, f);
      }
    }    

On 6/12/05, Chuan Dac Dang <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
>




More information about the ajug-members mailing list