View Javadoc

    1   /*
    2    * @(#) UIInitializer.java Nov 19, 2003
    3    *
    4    * Copyright (c) 2002-2005 Delft University of Technology Jaffalaan 5, 2628 BX
    5    * Delft, the Netherlands. All rights reserved.
    6    *
    7    * This software is proprietary information of Delft University of Technology
    8    * The code is published under the Lesser General Public License
    9    */
    10  package nl.tudelft.simulation.dsol.gui;
    11
    12  import java.awt.Color;
    13  import java.util.Enumeration;
    14
    15  import javax.swing.BorderFactory;
    16  import javax.swing.UIDefaults;
    17  import javax.swing.UIManager;
    18  import javax.swing.plaf.ColorUIResource;
    19
    20  /***
    21   * A UIInitializer <br>
    22   * (c) copyright 2002-2005 <a href="http://www.simulation.tudelft.nl">Delft
    23   * University of Technology </a>, the Netherlands. <br>
    24   * See for project information <a
    25   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
    26   * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
    27   * General Public License (LGPL) </a>, no warranty.
    28   *
    29   * @version $Revision$ $Date$
    30   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja">Peter Jacobs </a>
    31   */
    32  public final class UIInitializer
    33  {
    34  	/***
    35  	 * constructs a new UIInitializer (unreachable code)
    36  	 */
    37  	private UIInitializer()
    38  	{
    39  		// unreachable code
    40  	}
    41
    42  	/***
    43  	 * initializes the uiManager
    44  	 */
    45  	public static void initialize()
    46  	{
    47  		final Color backgroundColor = new Color(244, 244, 244);
    48  		final Color menuColor = Color.WHITE;
    49
    50  		UIManager
    51  				.put("Button.background", new ColorUIResource(backgroundColor));
    52  		UIManager.put("CheckBox.background", backgroundColor);
    53  		UIManager.put("CheckBox.border", BorderFactory.createEmptyBorder());
    54  		UIManager.put("ComboBox.background", new ColorUIResource(
    55  				backgroundColor));
    56  		UIManager.put("ComboBox.selectionBackground", new ColorUIResource(
    57  				backgroundColor));
    58  		UIManager.put("EditorPane.background", new ColorUIResource(
    59  				backgroundColor));
    60  		UIManager.put("Label.background", new ColorUIResource(backgroundColor));
    61  		UIManager.put("MenuBar.background", new ColorUIResource(menuColor));
    62  		UIManager.put("MenuItem.background", new ColorUIResource(menuColor));
    63  		UIManager.put("OptionPane.background", new ColorUIResource(
    64  				backgroundColor));
    65  		UIManager.put("Panel.background", new ColorUIResource(backgroundColor));
    66  		UIManager
    67  				.put("Slider.background", new ColorUIResource(backgroundColor));
    68  		UIManager.put("Table.background", new ColorUIResource(backgroundColor));
    69  		UIManager.put("Table.background", new ColorUIResource(backgroundColor));
    70  		UIManager.put("TextField.border", BorderFactory.createEmptyBorder());
    71  		UIManager.put("TextArea.Background", new ColorUIResource(
    72  				backgroundColor));
    73  		UIManager.put("TextField.inactiveBackground", new ColorUIResource(
    74  				backgroundColor));
    75  		UIManager.put("TextField.background", new ColorUIResource(
    76  				backgroundColor));
    77  		UIManager.put("TextField.selectionBackground", new ColorUIResource(
    78  				backgroundColor));
    79  		UIManager.put("Tree.background", new ColorUIResource(backgroundColor));
    80  		UIManager.put("Tree.textBackground", new ColorUIResource(
    81  				backgroundColor));
    82
    83  	}
    84
    85  	/***
    86  	 * shows all parameters of the current uimanager
    87  	 *
    88  	 * @param args the command-line arguments
    89  	 */
    90  	public static void main(final String[] args)
    91  	{
    92  		UIDefaults defaults = UIManager.getDefaults();
    93  		Enumeration keys = defaults.keys();
    94  		while (keys.hasMoreElements())
    95  		{
    96  			Object next = keys.nextElement();
    97  		}
    98  	}
    99  }