javax.swing

Class UIManager

Implemented Interfaces:
Serializable

public class UIManager
extends Object
implements Serializable

See Also:
Serialized Form

Nested Class Summary

static class
UIManager.LookAndFeelInfo

Constructor Summary

UIManager()

Method Summary

static void
addAuxiliaryLookAndFeel(LookAndFeel l)
Add a LookAndFeel to the list of auxiliary look and feels.
static void
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
static Object
get(Object key)
static Object
get(Object key, Locale locale)
static LookAndFeel[]
getAuxiliaryLookAndFeels()
static boolean
getBoolean(Object key)
Returns a boolean value from the defaults table, false if key is not present.
static boolean
getBoolean(Object key, Locale locale)
Returns a boolean value from the defaults table, false if key is not present.
static Border
getBorder(Object key)
Returns a border from the defaults table.
static Border
getBorder(Object key, Locale locale)
Returns a border from the defaults table.
static Color
getColor(Object key)
Returns a drawing color from the defaults table.
static Color
getColor(Object key, Locale locale)
Returns a drawing color from the defaults table.
static String
getCrossPlatformLookAndFeelClassName()
this string can be passed to Class.forName()
static UIDefaults
getDefaults()
Returns the default values for this look and feel.
static Dimension
getDimension(Object key)
Returns a dimension from the defaults table.
static Dimension
getDimension(Object key, Locale locale)
Returns a dimension from the defaults table.
static Font
getFont(Object key)
Retrieves a font from the defaults table of the current LookAndFeel.
static Font
getFont(Object key, Locale locale)
Retrieves a font from the defaults table of the current LookAndFeel.
static Icon
getIcon(Object key)
Returns an Icon from the defaults table.
static Icon
getIcon(Object key, Locale locale)
Returns an Icon from the defaults table.
static Insets
getInsets(Object key)
Returns an Insets object from the defaults table.
static Insets
getInsets(Object key, Locale locale)
Returns an Insets object from the defaults table.
static UIManager.LookAndFeelInfo[]
getInstalledLookAndFeels()
static int
getInt(Object key)
static int
getInt(Object key, Locale locale)
static LookAndFeel
getLookAndFeel()
static UIDefaults
getLookAndFeelDefaults()
Returns the UIDefaults table of the currently active look and feel.
static PropertyChangeListener[]
getPropertyChangeListeners()
Returns an array of all added PropertyChangeListener objects.
static String
getString(Object key)
Returns a string from the defaults table.
static String
getString(Object key, Locale locale)
Returns a string from the defaults table.
static String
getSystemLookAndFeelClassName()
Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class.
static ComponentUI
getUI(JComponent target)
Returns the Look and Feel object that renders the target component.
static void
installLookAndFeel(String name, String className)
Creates a new look and feel and adds it to the current array.
static void
installLookAndFeel(UIManager.LookAndFeelInfo info)
Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).
static Object
put(Object key, Object value)
Stores an object in the defaults table.
static boolean
removeAuxiliaryLookAndFeel(LookAndFeel laf)
static void
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
static void
setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
Replaces the current array of installed LookAndFeelInfos.
static void
setLookAndFeel(String className)
Set the current default look and feel using a class name.
static void
setLookAndFeel(LookAndFeel newLookAndFeel)
Set the current default look.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

UIManager

public UIManager()

Method Details

addAuxiliaryLookAndFeel

public static void addAuxiliaryLookAndFeel(LookAndFeel l)
Add a LookAndFeel to the list of auxiliary look and feels.


addPropertyChangeListener

public static void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.

Parameters:
listener - the listener to add


get

public static Object get(Object key)


get

public static Object get(Object key,
                         Locale locale)


getAuxiliaryLookAndFeels

public static LookAndFeel[] getAuxiliaryLookAndFeels()


getBoolean

public static boolean getBoolean(Object key)
Returns a boolean value from the defaults table, false if key is not present.

Since:
1.4


getBoolean

public static boolean getBoolean(Object key,
                                 Locale locale)
Returns a boolean value from the defaults table, false if key is not present.

Since:
1.4


getBorder

public static Border getBorder(Object key)
Returns a border from the defaults table.


getBorder

public static Border getBorder(Object key,
                               Locale locale)
Returns a border from the defaults table.

Since:
1.4


getColor

public static Color getColor(Object key)
Returns a drawing color from the defaults table.


getColor

public static Color getColor(Object key,
                             Locale locale)
Returns a drawing color from the defaults table.


getCrossPlatformLookAndFeelClassName

public static String getCrossPlatformLookAndFeelClassName()
this string can be passed to Class.forName()


getDefaults

public static UIDefaults getDefaults()
Returns the default values for this look and feel.


getDimension

public static Dimension getDimension(Object key)
Returns a dimension from the defaults table.


getDimension

public static Dimension getDimension(Object key,
                                     Locale locale)
Returns a dimension from the defaults table.


getFont

public static Font getFont(Object key)
Retrieves a font from the defaults table of the current LookAndFeel.

Parameters:
key - an Object that specifies the font. Typically, this is a String such as TitledBorder.font.


getFont

public static Font getFont(Object key,
                           Locale locale)
Retrieves a font from the defaults table of the current LookAndFeel.

Parameters:
key - an Object that specifies the font. Typically, this is a String such as TitledBorder.font.


getIcon

public static Icon getIcon(Object key)
Returns an Icon from the defaults table.


getIcon

public static Icon getIcon(Object key,
                           Locale locale)
Returns an Icon from the defaults table.


getInsets

public static Insets getInsets(Object key)
Returns an Insets object from the defaults table.


getInsets

public static Insets getInsets(Object key,
                               Locale locale)
Returns an Insets object from the defaults table.


getInstalledLookAndFeels

public static UIManager.LookAndFeelInfo[] getInstalledLookAndFeels()


getInt

public static int getInt(Object key)


getInt

public static int getInt(Object key,
                         Locale locale)


getLookAndFeel

public static LookAndFeel getLookAndFeel()


getLookAndFeelDefaults

public static UIDefaults getLookAndFeelDefaults()
Returns the UIDefaults table of the currently active look and feel.


getPropertyChangeListeners

public static PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all added PropertyChangeListener objects.

Returns:
an array of listeners

Since:
1.4


getString

public static String getString(Object key)
Returns a string from the defaults table.


getString

public static String getString(Object key,
                               Locale locale)
Returns a string from the defaults table.


getSystemLookAndFeelClassName

public static String getSystemLookAndFeelClassName()
Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class.


getUI

public static ComponentUI getUI(JComponent target)
Returns the Look and Feel object that renders the target component.


installLookAndFeel

public static void installLookAndFeel(String name,
                                      String className)
Creates a new look and feel and adds it to the current array.


installLookAndFeel

public static void installLookAndFeel(UIManager.LookAndFeelInfo info)
Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).


put

public static Object put(Object key,
                         Object value)
Stores an object in the defaults table.


removeAuxiliaryLookAndFeel

public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)


removePropertyChangeListener

public static void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.

Parameters:
listener - the listener to remove


setInstalledLookAndFeels

public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
Replaces the current array of installed LookAndFeelInfos.


setLookAndFeel

public static void setLookAndFeel(String className)
            throws ClassNotFoundException,
                   InstantiationException,
                   IllegalAccessException,
                   UnsupportedLookAndFeelException
Set the current default look and feel using a class name.


setLookAndFeel

public static void setLookAndFeel(LookAndFeel newLookAndFeel)
            throws UnsupportedLookAndFeelException
Set the current default look.


UIManager.java -- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.