Java Swing Look and Feel initLookAndFeel()

Here you can find the source of initLookAndFeel()

Description

init Look And Feel

License

Open Source License

Declaration

public static void initLookAndFeel() 

Method Source Code


//package com.java2s;
/*   $Id: Utils.java,v 1.2 2004/02/27 16:30:31 stuart_hc Exp $ $Name: V116 $
 *   FILE: Utils.java/* w w w .  j  ava 2  s.c o m*/
 *   DATE OF CREATION:   Thu Jan 09 14:14:35 2003
 *   AUTHOR :            Emmanuel Pietriga (emmanuel@w3.org)
 *   MODIF:              Wed Jan 15 10:29:31 2003 by Emmanuel Pietriga
 *   Copyright (c) Emmanuel Pietriga, 2002. All Rights Reserved
 *   Licensed under the GNU LGPL. For full terms see the file COPYING.
 */

import java.awt.Font;
import java.util.Enumeration;
import javax.swing.UIManager;

public class Main {
    static Font smallFont = new Font("Dialog", 0, 10);
    static java.awt.Color pastelBlue = new java.awt.Color(156, 154, 206);

    public static void initLookAndFeel() {
        //    try {UIManager.setLookAndFeel(currentLookAndFeel);}
        //    catch(Exception ex){System.err.println("An error occured while trying to change the look and feel\n"+ex);}
        String key;
        for (Enumeration e = UIManager.getLookAndFeelDefaults().keys(); e.hasMoreElements();) {
            key = (String) e.nextElement();
            if (key.endsWith(".font") || key.endsWith("Font")) {
                UIManager.put(key, smallFont);
            }
        }
        UIManager.put("ProgressBar.foreground", pastelBlue);
        UIManager.put("ProgressBar.background", java.awt.Color.lightGray);
        UIManager.put("Label.foreground", java.awt.Color.black);
    }
}

Related

  1. getLookAndFeelToSave()
  2. getNimbusLAF()
  3. getSortedInstalledLAFInfos()
  4. getSysDefLookandFeel()
  5. getSystemLAF()
  6. initLookAndFeel()
  7. initLookAndFeel(final String className)
  8. initLookAndFeelIntern(final String className)
  9. installLookAndFeel()