< prev index next >

src/java.desktop/share/classes/javax/swing/UIManager.java

Print this page

        

*** 96,114 **** * <h3>Default look and feel</h3> * * The class used for the default look and feel is chosen in the following * manner: * <ol> ! * <li>If the system property <code>swing.defaultlaf</code> is * {@code non-null}, use its value as the default look and feel class * name. ! * <li>If the {@link java.util.Properties} file <code>swing.properties</code> ! * exists and contains the key <code>swing.defaultlaf</code>, * use its value as the default look and feel class name. The location ! * that is checked for <code>swing.properties</code> may vary depending * upon the implementation of the Java platform. Typically the ! * <code>swing.properties</code> file is located in the <code>conf</code> * subdirectory of the Java installation directory. * Refer to the release notes of the implementation being used for * further details. * <li>Otherwise use the cross platform look and feel. * </ol> --- 96,114 ---- * <h3>Default look and feel</h3> * * The class used for the default look and feel is chosen in the following * manner: * <ol> ! * <li>If the system property {@code swing.defaultlaf} is * {@code non-null}, use its value as the default look and feel class * name. ! * <li>If the {@link java.util.Properties} file {@code swing.properties} ! * exists and contains the key {@code swing.defaultlaf}, * use its value as the default look and feel class name. The location ! * that is checked for {@code swing.properties} may vary depending * upon the implementation of the Java platform. Typically the ! * {@code swing.properties} file is located in the {@code conf} * subdirectory of the Java installation directory. * Refer to the release notes of the implementation being used for * further details. * <li>Otherwise use the cross platform look and feel. * </ol>
*** 166,193 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Thomas Ball * @author Hans Muller * @since 1.2 */ @SuppressWarnings("serial") // Same-version serialization only public class UIManager implements Serializable { /** ! * This class defines the state managed by the <code>UIManager</code>. For * Swing applications the fields in this class could just as well ! * be static members of <code>UIManager</code> however we give them * "AppContext" * scope instead so that applets (and potentially multiple lightweight * applications running in a single VM) have their own state. For example, ! * an applet can alter its look and feel, see <code>setLookAndFeel</code>. * Doing so has no affect on other applets (or the browser). */ private static class LAFState { Properties swingProps; --- 166,193 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @author Thomas Ball * @author Hans Muller * @since 1.2 */ @SuppressWarnings("serial") // Same-version serialization only public class UIManager implements Serializable { /** ! * This class defines the state managed by the {@code UIManager}. For * Swing applications the fields in this class could just as well ! * be static members of {@code UIManager} however we give them * "AppContext" * scope instead so that applets (and potentially multiple lightweight * applications running in a single VM) have their own state. For example, ! * an applet can alter its look and feel, see {@code setLookAndFeel}. * Doing so has no affect on other applets (or the browser). */ private static class LAFState { Properties swingProps;
*** 209,221 **** UIDefaults getSystemDefaults() { return tables[1]; } void setSystemDefaults(UIDefaults x) { tables[1] = x; } /** * Returns the SwingPropertyChangeSupport for the current ! * AppContext. If <code>create</code> is a true, a non-null ! * <code>SwingPropertyChangeSupport</code> will be returned, if ! * <code>create</code> is false and this has not been invoked * with true, null will be returned. */ public synchronized SwingPropertyChangeSupport getPropertyChangeSupport(boolean create) { if (create && changeSupport == null) { --- 209,221 ---- UIDefaults getSystemDefaults() { return tables[1]; } void setSystemDefaults(UIDefaults x) { tables[1] = x; } /** * Returns the SwingPropertyChangeSupport for the current ! * AppContext. If {@code create} is a true, a non-null ! * {@code SwingPropertyChangeSupport} will be returned, if ! * {@code create} is false and this has not been invoked * with true, null will be returned. */ public synchronized SwingPropertyChangeSupport getPropertyChangeSupport(boolean create) { if (create && changeSupport == null) {
*** 232,243 **** /* Lock object used in place of class object for synchronization. (4187686) */ private static final Object classLock = new Object(); /** ! * Return the <code>LAFState</code> object, lazily create one if necessary. ! * All access to the <code>LAFState</code> fields is done via this method, * for example: * <pre> * getLAFState().initialized = true; * </pre> */ --- 232,243 ---- /* Lock object used in place of class object for synchronization. (4187686) */ private static final Object classLock = new Object(); /** ! * Return the {@code LAFState} object, lazily create one if necessary. ! * All access to the {@code LAFState} fields is done via this method, * for example: * <pre> * getLAFState().initialized = true; * </pre> */
*** 257,291 **** } return rv; } ! /* Keys used in the <code>swing.properties</code> properties file. * See loadUserProperties(), initialize(). */ private static final String defaultLAFKey = "swing.defaultlaf"; private static final String auxiliaryLAFsKey = "swing.auxiliarylaf"; private static final String multiplexingLAFKey = "swing.plaf.multiplexinglaf"; private static final String installedLAFsKey = "swing.installedlafs"; private static final String disableMnemonicKey = "swing.disablenavaids"; /** ! * Return a <code>swing.properties</code> file key for the attribute of specified * look and feel. The attr is either "name" or "class", a typical * key would be: "swing.installedlaf.windows.name" */ private static String makeInstalledLAFKey(String laf, String attr) { return "swing.installedlaf." + laf + "." + attr; } /** ! * The location of the <code>swing.properties</code> property file is * implementation-specific. ! * It is typically located in the <code>conf</code> subdirectory of the Java * installation directory. This method returns a bogus filename ! * if <code>java.home</code> isn't defined. */ private static String makeSwingPropertiesFilename() { String sep = File.separator; // No need to wrap this in a doPrivileged as it's called from // a doPrivileged. --- 257,291 ---- } return rv; } ! /* Keys used in the {@code swing.properties} properties file. * See loadUserProperties(), initialize(). */ private static final String defaultLAFKey = "swing.defaultlaf"; private static final String auxiliaryLAFsKey = "swing.auxiliarylaf"; private static final String multiplexingLAFKey = "swing.plaf.multiplexinglaf"; private static final String installedLAFsKey = "swing.installedlafs"; private static final String disableMnemonicKey = "swing.disablenavaids"; /** ! * Return a {@code swing.properties} file key for the attribute of specified * look and feel. The attr is either "name" or "class", a typical * key would be: "swing.installedlaf.windows.name" */ private static String makeInstalledLAFKey(String laf, String attr) { return "swing.installedlaf." + laf + "." + attr; } /** ! * The location of the {@code swing.properties} property file is * implementation-specific. ! * It is typically located in the {@code conf} subdirectory of the Java * installation directory. This method returns a bogus filename ! * if {@code java.home} isn't defined. */ private static String makeSwingPropertiesFilename() { String sep = File.separator; // No need to wrap this in a doPrivileged as it's called from // a doPrivileged.
*** 297,365 **** } /** * Provides a little information about an installed ! * <code>LookAndFeel</code> for the sake of configuring a menu or * for initial application set up. * * @see UIManager#getInstalledLookAndFeels * @see LookAndFeel */ public static class LookAndFeelInfo { private String name; private String className; /** ! * Constructs a <code>UIManager</code>s ! * <code>LookAndFeelInfo</code> object. * ! * @param name a <code>String</code> specifying the name of * the look and feel ! * @param className a <code>String</code> specifying the name of * the class that implements the look and feel */ public LookAndFeelInfo(String name, String className) { this.name = name; this.className = className; } /** * Returns the name of the look and feel in a form suitable * for a menu or other presentation ! * @return a <code>String</code> containing the name * @see LookAndFeel#getName */ public String getName() { return name; } /** * Returns the name of the class that implements this look and feel. * @return the name of the class that implements this ! * <code>LookAndFeel</code> * @see LookAndFeel */ public String getClassName() { return className; } /** * Returns a string that displays and identifies this * object's properties. * ! * @return a <code>String</code> representation of this object */ public String toString() { return getClass().getName() + "[" + getName() + " " + getClassName() + "]"; } } /** ! * The default value of <code>installedLAFS</code> is used when no ! * <code>swing.properties</code> * file is available or if the file doesn't contain a "swing.installedlafs" * property. * * @see #initializeInstalledLAFs */ --- 297,365 ---- } /** * Provides a little information about an installed ! * {@code LookAndFeel} for the sake of configuring a menu or * for initial application set up. * * @see UIManager#getInstalledLookAndFeels * @see LookAndFeel */ public static class LookAndFeelInfo { private String name; private String className; /** ! * Constructs a {@code UIManager}s ! * {@code LookAndFeelInfo} object. * ! * @param name a {@code String} specifying the name of * the look and feel ! * @param className a {@code String} specifying the name of * the class that implements the look and feel */ public LookAndFeelInfo(String name, String className) { this.name = name; this.className = className; } /** * Returns the name of the look and feel in a form suitable * for a menu or other presentation ! * @return a {@code String} containing the name * @see LookAndFeel#getName */ public String getName() { return name; } /** * Returns the name of the class that implements this look and feel. * @return the name of the class that implements this ! * {@code LookAndFeel} * @see LookAndFeel */ public String getClassName() { return className; } /** * Returns a string that displays and identifies this * object's properties. * ! * @return a {@code String} representation of this object */ public String toString() { return getClass().getName() + "[" + getName() + " " + getClassName() + "]"; } } /** ! * The default value of {@code installedLAFS} is used when no ! * {@code swing.properties} * file is available or if the file doesn't contain a "swing.installedlafs" * property. * * @see #initializeInstalledLAFs */
*** 398,408 **** /** * Returns an array of {@code LookAndFeelInfo}s representing the * {@code LookAndFeel} implementations currently available. The ! * <code>LookAndFeelInfo</code> objects can be used by an * application to construct a menu of look and feel options for * the user, or to determine which look and feel to set at startup * time. To avoid the penalty of creating numerous {@code * LookAndFeel} objects, {@code LookAndFeelInfo} maintains the * class name of the {@code LookAndFeel} class, not the actual --- 398,408 ---- /** * Returns an array of {@code LookAndFeelInfo}s representing the * {@code LookAndFeel} implementations currently available. The ! * {@code LookAndFeelInfo} objects can be used by an * application to construct a menu of look and feel options for * the user, or to determine which look and feel to set at startup * time. To avoid the penalty of creating numerous {@code * LookAndFeel} objects, {@code LookAndFeelInfo} maintains the * class name of the {@code LookAndFeel} class, not the actual
*** 412,422 **** * from an instance of {@code LookAndFeelInfo}: * <pre> * UIManager.setLookAndFeel(info.getClassName()); * </pre> * ! * @return an array of <code>LookAndFeelInfo</code> objects * @see #setLookAndFeel */ public static LookAndFeelInfo[] getInstalledLookAndFeels() { maybeInitialize(); LookAndFeelInfo[] ilafs = getLAFState().installedLAFs; --- 412,422 ---- * from an instance of {@code LookAndFeelInfo}: * <pre> * UIManager.setLookAndFeel(info.getClassName()); * </pre> * ! * @return an array of {@code LookAndFeelInfo} objects * @see #setLookAndFeel */ public static LookAndFeelInfo[] getInstalledLookAndFeels() { maybeInitialize(); LookAndFeelInfo[] ilafs = getLAFState().installedLAFs;
*** 433,443 **** * Sets the set of available look and feels. While this method does * not check to ensure all of the {@code LookAndFeelInfos} are * {@code non-null}, it is strongly recommended that only {@code non-null} * values are supplied in the {@code infos} array. * ! * @param infos set of <code>LookAndFeelInfo</code> objects specifying * the available look and feels * * @see #getInstalledLookAndFeels * @throws NullPointerException if {@code infos} is {@code null} */ --- 433,443 ---- * Sets the set of available look and feels. While this method does * not check to ensure all of the {@code LookAndFeelInfos} are * {@code non-null}, it is strongly recommended that only {@code non-null} * values are supplied in the {@code infos} array. * ! * @param infos set of {@code LookAndFeelInfo} objects specifying * the available look and feels * * @see #getInstalledLookAndFeels * @throws NullPointerException if {@code infos} is {@code null} */
*** 451,464 **** } /** * Adds the specified look and feel to the set of available look ! * and feels. While this method allows a {@code null} {@code info}, * it is strongly recommended that a {@code non-null} value be used. * ! * @param info a <code>LookAndFeelInfo</code> object that names the * look and feel and identifies the class that implements it * @see #setInstalledLookAndFeels */ public static void installLookAndFeel(LookAndFeelInfo info) { LookAndFeelInfo[] infos = getInstalledLookAndFeels(); --- 451,464 ---- } /** * Adds the specified look and feel to the set of available look ! * and feels. While this method allows a {@code null info}, * it is strongly recommended that a {@code non-null} value be used. * ! * @param info a {@code LookAndFeelInfo} object that names the * look and feel and identifies the class that implements it * @see #setInstalledLookAndFeels */ public static void installLookAndFeel(LookAndFeelInfo info) { LookAndFeelInfo[] infos = getInstalledLookAndFeels();
*** 483,506 **** installLookAndFeel(new LookAndFeelInfo(name, className)); } /** ! * Returns the current look and feel or <code>null</code>. * ! * @return current look and feel, or <code>null</code> * @see #setLookAndFeel */ public static LookAndFeel getLookAndFeel() { maybeInitialize(); return getLAFState().lookAndFeel; } /** * Sets the current look and feel to {@code newLookAndFeel}. ! * If the current look and feel is {@code non-null} {@code * uninitialize} is invoked on it. If {@code newLookAndFeel} is * {@code non-null}, {@code initialize} is invoked on it followed * by {@code getDefaults}. The defaults returned from {@code * newLookAndFeel.getDefaults()} replace those of the defaults * from the previous look and feel. If the {@code newLookAndFeel} is --- 483,506 ---- installLookAndFeel(new LookAndFeelInfo(name, className)); } /** ! * Returns the current look and feel or {@code null}. * ! * @return current look and feel, or {@code null} * @see #setLookAndFeel */ public static LookAndFeel getLookAndFeel() { maybeInitialize(); return getLAFState().lookAndFeel; } /** * Sets the current look and feel to {@code newLookAndFeel}. ! * If the current look and feel is {@code non-null * uninitialize} is invoked on it. If {@code newLookAndFeel} is * {@code non-null}, {@code initialize} is invoked on it followed * by {@code getDefaults}. The defaults returned from {@code * newLookAndFeel.getDefaults()} replace those of the defaults * from the previous look and feel. If the {@code newLookAndFeel} is
*** 558,574 **** * name, using the current thread's context class loader, and * passes it to {@code setLookAndFeel(LookAndFeel)}. * * @param className a string specifying the name of the class that implements * the look and feel ! * @exception ClassNotFoundException if the <code>LookAndFeel</code> * class could not be found * @exception InstantiationException if a new instance of the class * couldn't be created * @exception IllegalAccessException if the class or initializer isn't accessible * @exception UnsupportedLookAndFeelException if ! * <code>lnf.isSupportedLookAndFeel()</code> is false * @throws ClassCastException if {@code className} does not identify * a class that extends {@code LookAndFeel} */ public static void setLookAndFeel(String className) throws ClassNotFoundException, --- 558,574 ---- * name, using the current thread's context class loader, and * passes it to {@code setLookAndFeel(LookAndFeel)}. * * @param className a string specifying the name of the class that implements * the look and feel ! * @exception ClassNotFoundException if the {@code LookAndFeel} * class could not be found * @exception InstantiationException if a new instance of the class * couldn't be created * @exception IllegalAccessException if the class or initializer isn't accessible * @exception UnsupportedLookAndFeelException if ! * {@code lnf.isSupportedLookAndFeel()} is false * @throws ClassCastException if {@code className} does not identify * a class that extends {@code LookAndFeel} */ public static void setLookAndFeel(String className) throws ClassNotFoundException,
*** 585,601 **** setLookAndFeel((LookAndFeel)(lnfClass.newInstance())); } } /** ! * Returns the name of the <code>LookAndFeel</code> class that implements * the native system look and feel if there is one, otherwise ! * the name of the default cross platform <code>LookAndFeel</code> * class. This value can be overriden by setting the ! * <code>swing.systemlaf</code> system property. * ! * @return the <code>String</code> of the <code>LookAndFeel</code> * class * * @see #setLookAndFeel * @see #getCrossPlatformLookAndFeelClassName */ --- 585,601 ---- setLookAndFeel((LookAndFeel)(lnfClass.newInstance())); } } /** ! * Returns the name of the {@code LookAndFeel} class that implements * the native system look and feel if there is one, otherwise ! * the name of the default cross platform {@code LookAndFeel} * class. This value can be overriden by setting the ! * {@code swing.systemlaf} system property. * ! * @return the {@code String} of the {@code LookAndFeel} * class * * @see #setLookAndFeel * @see #getCrossPlatformLookAndFeelClassName */
*** 630,643 **** return getCrossPlatformLookAndFeelClassName(); } /** ! * Returns the name of the <code>LookAndFeel</code> class that implements * the default cross platform look and feel -- the Java * Look and Feel (JLF). This value can be overriden by setting the ! * <code>swing.crossplatformlaf</code> system property. * * @return a string with the JLF implementation-class * @see #setLookAndFeel * @see #getSystemLookAndFeelClassName */ --- 630,643 ---- return getCrossPlatformLookAndFeelClassName(); } /** ! * Returns the name of the {@code LookAndFeel} class that implements * the default cross platform look and feel -- the Java * Look and Feel (JLF). This value can be overriden by setting the ! * {@code swing.crossplatformlaf} system property. * * @return a string with the JLF implementation-class * @see #setLookAndFeel * @see #getSystemLookAndFeelClassName */
*** 653,675 **** /** * Returns the defaults. The returned defaults resolve using the * logic specified in the class documentation. * ! * @return a <code>UIDefaults</code> object containing the default values */ public static UIDefaults getDefaults() { maybeInitialize(); return getLAFState().multiUIDefaults; } /** * Returns a font from the defaults. If the value for {@code key} is * not a {@code Font}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the font ! * @return the <code>Font</code> object * @throws NullPointerException if {@code key} is {@code null} */ public static Font getFont(Object key) { return getDefaults().getFont(key); } --- 653,675 ---- /** * Returns the defaults. The returned defaults resolve using the * logic specified in the class documentation. * ! * @return a {@code UIDefaults} object containing the default values */ public static UIDefaults getDefaults() { maybeInitialize(); return getLAFState().multiUIDefaults; } /** * Returns a font from the defaults. If the value for {@code key} is * not a {@code Font}, {@code null} is returned. * ! * @param key an {@code Object} specifying the font ! * @return the {@code Font} object * @throws NullPointerException if {@code key} is {@code null} */ public static Font getFont(Object key) { return getDefaults().getFont(key); }
*** 677,691 **** /** * Returns a font from the defaults that is appropriate * for the given locale. If the value for {@code key} is * not a {@code Font}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the font ! * @param l the <code>Locale</code> for which the font is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Font</code> object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Font getFont(Object key, Locale l) { return getDefaults().getFont(key,l); --- 677,691 ---- /** * Returns a font from the defaults that is appropriate * for the given locale. If the value for {@code key} is * not a {@code Font}, {@code null} is returned. * ! * @param key an {@code Object} specifying the font ! * @param l the {@code Locale} for which the font is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Font} object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Font getFont(Object key, Locale l) { return getDefaults().getFont(key,l);
*** 693,704 **** /** * Returns a color from the defaults. If the value for {@code key} is * not a {@code Color}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the color ! * @return the <code>Color</code> object * @throws NullPointerException if {@code key} is {@code null} */ public static Color getColor(Object key) { return getDefaults().getColor(key); } --- 693,704 ---- /** * Returns a color from the defaults. If the value for {@code key} is * not a {@code Color}, {@code null} is returned. * ! * @param key an {@code Object} specifying the color ! * @return the {@code Color} object * @throws NullPointerException if {@code key} is {@code null} */ public static Color getColor(Object key) { return getDefaults().getColor(key); }
*** 706,749 **** /** * Returns a color from the defaults that is appropriate * for the given locale. If the value for {@code key} is * not a {@code Color}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the color ! * @param l the <code>Locale</code> for which the color is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Color</code> object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Color getColor(Object key, Locale l) { return getDefaults().getColor(key,l); } /** ! * Returns an <code>Icon</code> from the defaults. If the value for * {@code key} is not an {@code Icon}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the icon ! * @return the <code>Icon</code> object * @throws NullPointerException if {@code key} is {@code null} */ public static Icon getIcon(Object key) { return getDefaults().getIcon(key); } /** ! * Returns an <code>Icon</code> from the defaults that is appropriate * for the given locale. If the value for * {@code key} is not an {@code Icon}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the icon ! * @param l the <code>Locale</code> for which the icon is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Icon</code> object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Icon getIcon(Object key, Locale l) { return getDefaults().getIcon(key,l); --- 706,749 ---- /** * Returns a color from the defaults that is appropriate * for the given locale. If the value for {@code key} is * not a {@code Color}, {@code null} is returned. * ! * @param key an {@code Object} specifying the color ! * @param l the {@code Locale} for which the color is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Color} object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Color getColor(Object key, Locale l) { return getDefaults().getColor(key,l); } /** ! * Returns an {@code Icon} from the defaults. If the value for * {@code key} is not an {@code Icon}, {@code null} is returned. * ! * @param key an {@code Object} specifying the icon ! * @return the {@code Icon} object * @throws NullPointerException if {@code key} is {@code null} */ public static Icon getIcon(Object key) { return getDefaults().getIcon(key); } /** ! * Returns an {@code Icon} from the defaults that is appropriate * for the given locale. If the value for * {@code key} is not an {@code Icon}, {@code null} is returned. * ! * @param key an {@code Object} specifying the icon ! * @param l the {@code Locale} for which the icon is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Icon} object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Icon getIcon(Object key, Locale l) { return getDefaults().getIcon(key,l);
*** 751,762 **** /** * Returns a border from the defaults. If the value for * {@code key} is not a {@code Border}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the border ! * @return the <code>Border</code> object * @throws NullPointerException if {@code key} is {@code null} */ public static Border getBorder(Object key) { return getDefaults().getBorder(key); } --- 751,762 ---- /** * Returns a border from the defaults. If the value for * {@code key} is not a {@code Border}, {@code null} is returned. * ! * @param key an {@code Object} specifying the border ! * @return the {@code Border} object * @throws NullPointerException if {@code key} is {@code null} */ public static Border getBorder(Object key) { return getDefaults().getBorder(key); }
*** 764,778 **** /** * Returns a border from the defaults that is appropriate * for the given locale. If the value for * {@code key} is not a {@code Border}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the border ! * @param l the <code>Locale</code> for which the border is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Border</code> object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Border getBorder(Object key, Locale l) { return getDefaults().getBorder(key,l); --- 764,778 ---- /** * Returns a border from the defaults that is appropriate * for the given locale. If the value for * {@code key} is not a {@code Border}, {@code null} is returned. * ! * @param key an {@code Object} specifying the border ! * @param l the {@code Locale} for which the border is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Border} object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Border getBorder(Object key, Locale l) { return getDefaults().getBorder(key,l);
*** 780,791 **** /** * Returns a string from the defaults. If the value for * {@code key} is not a {@code String}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the string ! * @return the <code>String</code> * @throws NullPointerException if {@code key} is {@code null} */ public static String getString(Object key) { return getDefaults().getString(key); } --- 780,791 ---- /** * Returns a string from the defaults. If the value for * {@code key} is not a {@code String}, {@code null} is returned. * ! * @param key an {@code Object} specifying the string ! * @return the {@code String} * @throws NullPointerException if {@code key} is {@code null} */ public static String getString(Object key) { return getDefaults().getString(key); }
*** 793,807 **** /** * Returns a string from the defaults that is appropriate for the * given locale. If the value for * {@code key} is not a {@code String}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the string ! * @param l the <code>Locale</code> for which the string is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>String</code> * @since 1.4 * @throws NullPointerException if {@code key} is {@code null} */ public static String getString(Object key, Locale l) { return getDefaults().getString(key,l); --- 793,807 ---- /** * Returns a string from the defaults that is appropriate for the * given locale. If the value for * {@code key} is not a {@code String}, {@code null} is returned. * ! * @param key an {@code Object} specifying the string ! * @param l the {@code Locale} for which the string is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code String} * @since 1.4 * @throws NullPointerException if {@code key} is {@code null} */ public static String getString(Object key, Locale l) { return getDefaults().getString(key,l);
*** 810,824 **** /** * Returns a string from the defaults that is appropriate for the * given locale. If the value for * {@code key} is not a {@code String}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the string * @param c {@code Component} used to determine the locale; * {@code null} implies the default locale as * returned by {@code Locale.getDefault()} ! * @return the <code>String</code> * @throws NullPointerException if {@code key} is {@code null} */ static String getString(Object key, Component c) { Locale l = (c == null) ? Locale.getDefault() : c.getLocale(); return getString(key, l); --- 810,824 ---- /** * Returns a string from the defaults that is appropriate for the * given locale. If the value for * {@code key} is not a {@code String}, {@code null} is returned. * ! * @param key an {@code Object} specifying the string * @param c {@code Component} used to determine the locale; * {@code null} implies the default locale as * returned by {@code Locale.getDefault()} ! * @return the {@code String} * @throws NullPointerException if {@code key} is {@code null} */ static String getString(Object key, Component c) { Locale l = (c == null) ? Locale.getDefault() : c.getLocale(); return getString(key, l);
*** 827,837 **** /** * Returns an integer from the defaults. If the value for * {@code key} is not an {@code Integer}, or does not exist, * {@code 0} is returned. * ! * @param key an <code>Object</code> specifying the int * @return the int * @throws NullPointerException if {@code key} is {@code null} */ public static int getInt(Object key) { return getDefaults().getInt(key); --- 827,837 ---- /** * Returns an integer from the defaults. If the value for * {@code key} is not an {@code Integer}, or does not exist, * {@code 0} is returned. * ! * @param key an {@code Object} specifying the int * @return the int * @throws NullPointerException if {@code key} is {@code null} */ public static int getInt(Object key) { return getDefaults().getInt(key);
*** 841,852 **** * Returns an integer from the defaults that is appropriate * for the given locale. If the value for * {@code key} is not an {@code Integer}, or does not exist, * {@code 0} is returned. * ! * @param key an <code>Object</code> specifying the int ! * @param l the <code>Locale</code> for which the int is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled * @return the int * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 --- 841,852 ---- * Returns an integer from the defaults that is appropriate * for the given locale. If the value for * {@code key} is not an {@code Integer}, or does not exist, * {@code 0} is returned. * ! * @param key an {@code Object} specifying the int ! * @param l the {@code Locale} for which the int is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled * @return the int * @throws NullPointerException if {@code key} is {@code null} * @since 1.4
*** 858,885 **** /** * Returns a boolean from the defaults which is associated with * the key value. If the key is not found or the key doesn't represent * a boolean value then {@code false} is returned. * ! * @param key an <code>Object</code> specifying the key for the desired boolean value * @return the boolean value corresponding to the key * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static boolean getBoolean(Object key) { return getDefaults().getBoolean(key); } /** * Returns a boolean from the defaults which is associated with ! * the key value and the given <code>Locale</code>. If the key is not * found or the key doesn't represent * a boolean value then {@code false} will be returned. * ! * @param key an <code>Object</code> specifying the key for the desired * boolean value ! * @param l the <code>Locale</code> for which the boolean is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled * @return the boolean value corresponding to the key * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 --- 858,885 ---- /** * Returns a boolean from the defaults which is associated with * the key value. If the key is not found or the key doesn't represent * a boolean value then {@code false} is returned. * ! * @param key an {@code Object} specifying the key for the desired boolean value * @return the boolean value corresponding to the key * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static boolean getBoolean(Object key) { return getDefaults().getBoolean(key); } /** * Returns a boolean from the defaults which is associated with ! * the key value and the given {@code Locale}. If the key is not * found or the key doesn't represent * a boolean value then {@code false} will be returned. * ! * @param key an {@code Object} specifying the key for the desired * boolean value ! * @param l the {@code Locale} for which the boolean is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled * @return the boolean value corresponding to the key * @throws NullPointerException if {@code key} is {@code null} * @since 1.4
*** 887,917 **** public static boolean getBoolean(Object key, Locale l) { return getDefaults().getBoolean(key,l); } /** ! * Returns an <code>Insets</code> object from the defaults. If the value * for {@code key} is not an {@code Insets}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the <code>Insets</code> object ! * @return the <code>Insets</code> object * @throws NullPointerException if {@code key} is {@code null} */ public static Insets getInsets(Object key) { return getDefaults().getInsets(key); } /** ! * Returns an <code>Insets</code> object from the defaults that is * appropriate for the given locale. If the value * for {@code key} is not an {@code Insets}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the <code>Insets</code> object ! * @param l the <code>Locale</code> for which the object is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Insets</code> object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Insets getInsets(Object key, Locale l) { return getDefaults().getInsets(key,l); --- 887,917 ---- public static boolean getBoolean(Object key, Locale l) { return getDefaults().getBoolean(key,l); } /** ! * Returns an {@code Insets} object from the defaults. If the value * for {@code key} is not an {@code Insets}, {@code null} is returned. * ! * @param key an {@code Object} specifying the {@code Insets} object ! * @return the {@code Insets} object * @throws NullPointerException if {@code key} is {@code null} */ public static Insets getInsets(Object key) { return getDefaults().getInsets(key); } /** ! * Returns an {@code Insets} object from the defaults that is * appropriate for the given locale. If the value * for {@code key} is not an {@code Insets}, {@code null} is returned. * ! * @param key an {@code Object} specifying the {@code Insets} object ! * @param l the {@code Locale} for which the object is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Insets} object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Insets getInsets(Object key, Locale l) { return getDefaults().getInsets(key,l);
*** 919,930 **** /** * Returns a dimension from the defaults. If the value * for {@code key} is not a {@code Dimension}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the dimension object ! * @return the <code>Dimension</code> object * @throws NullPointerException if {@code key} is {@code null} */ public static Dimension getDimension(Object key) { return getDefaults().getDimension(key); } --- 919,930 ---- /** * Returns a dimension from the defaults. If the value * for {@code key} is not a {@code Dimension}, {@code null} is returned. * ! * @param key an {@code Object} specifying the dimension object ! * @return the {@code Dimension} object * @throws NullPointerException if {@code key} is {@code null} */ public static Dimension getDimension(Object key) { return getDefaults().getDimension(key); }
*** 932,973 **** /** * Returns a dimension from the defaults that is appropriate * for the given locale. If the value * for {@code key} is not a {@code Dimension}, {@code null} is returned. * ! * @param key an <code>Object</code> specifying the dimension object ! * @param l the <code>Locale</code> for which the object is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Dimension</code> object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Dimension getDimension(Object key, Locale l) { return getDefaults().getDimension(key,l); } /** * Returns an object from the defaults. * ! * @param key an <code>Object</code> specifying the desired object ! * @return the <code>Object</code> * @throws NullPointerException if {@code key} is {@code null} */ public static Object get(Object key) { return getDefaults().get(key); } /** * Returns an object from the defaults that is appropriate for * the given locale. * ! * @param key an <code>Object</code> specifying the desired object ! * @param l the <code>Locale</code> for which the object is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the <code>Object</code> * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Object get(Object key, Locale l) { return getDefaults().get(key,l); --- 932,973 ---- /** * Returns a dimension from the defaults that is appropriate * for the given locale. If the value * for {@code key} is not a {@code Dimension}, {@code null} is returned. * ! * @param key an {@code Object} specifying the dimension object ! * @param l the {@code Locale} for which the object is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Dimension} object * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Dimension getDimension(Object key, Locale l) { return getDefaults().getDimension(key,l); } /** * Returns an object from the defaults. * ! * @param key an {@code Object} specifying the desired object ! * @return the {@code Object} * @throws NullPointerException if {@code key} is {@code null} */ public static Object get(Object key) { return getDefaults().get(key); } /** * Returns an object from the defaults that is appropriate for * the given locale. * ! * @param key an {@code Object} specifying the desired object ! * @param l the {@code Locale} for which the object is desired; refer * to {@code UIDefaults} for details on how a {@code null} * {@code Locale} is handled ! * @return the {@code Object} * @throws NullPointerException if {@code key} is {@code null} * @since 1.4 */ public static Object get(Object key, Locale l) { return getDefaults().get(key,l);
*** 976,990 **** /** * Stores an object in the developer defaults. This is a cover method * for {@code getDefaults().put(key, value)}. This only effects the * developer defaults, not the system or look and feel defaults. * ! * @param key an <code>Object</code> specifying the retrieval key ! * @param value the <code>Object</code> to store; refer to * {@code UIDefaults} for details on how {@code null} is * handled ! * @return the <code>Object</code> returned by {@link UIDefaults#put} * @throws NullPointerException if {@code key} is {@code null} * @see UIDefaults#put */ public static Object put(Object key, Object value) { return getDefaults().put(key, value); --- 976,990 ---- /** * Stores an object in the developer defaults. This is a cover method * for {@code getDefaults().put(key, value)}. This only effects the * developer defaults, not the system or look and feel defaults. * ! * @param key an {@code Object} specifying the retrieval key ! * @param value the {@code Object} to store; refer to * {@code UIDefaults} for details on how {@code null} is * handled ! * @return the {@code Object} returned by {@link UIDefaults#put} * @throws NullPointerException if {@code key} is {@code null} * @see UIDefaults#put */ public static Object put(Object key, Object value) { return getDefaults().put(key, value);
*** 996,1008 **** * {@code getDefaults().getUI(target)}. However, if an auxiliary * look and feel has been installed, this first invokes * {@code getUI(target)} on the multiplexing look and feel's * defaults, and returns that value if it is {@code non-null}. * ! * @param target the <code>JComponent</code> to return the * {@code ComponentUI} for ! * @return the <code>ComponentUI</code> object for {@code target} * @throws NullPointerException if {@code target} is {@code null} * @see UIDefaults#getUI */ public static ComponentUI getUI(JComponent target) { maybeInitialize(); --- 996,1008 ---- * {@code getDefaults().getUI(target)}. However, if an auxiliary * look and feel has been installed, this first invokes * {@code getUI(target)} on the multiplexing look and feel's * defaults, and returns that value if it is {@code non-null}. * ! * @param target the {@code JComponent} to return the * {@code ComponentUI} for ! * @return the {@code ComponentUI} object for {@code target} * @throws NullPointerException if {@code target} is {@code null} * @see UIDefaults#getUI */ public static ComponentUI getUI(JComponent target) { maybeInitialize();
*** 1028,1049 **** * In general, developers should use the {@code UIDefaults} returned from * {@code getDefaults()}. As the current look and feel may expect * certain values to exist, altering the {@code UIDefaults} returned * from this method could have unexpected results. * ! * @return <code>UIDefaults</code> from the current look and feel * @see #getDefaults * @see #setLookAndFeel(LookAndFeel) * @see LookAndFeel#getDefaults */ public static UIDefaults getLookAndFeelDefaults() { maybeInitialize(); return getLAFState().getLookAndFeelDefaults(); } /** ! * Finds the Multiplexing <code>LookAndFeel</code>. */ private static LookAndFeel getMultiLookAndFeel() { LookAndFeel multiLookAndFeel = getLAFState().multiLookAndFeel; if (multiLookAndFeel == null) { String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel"; --- 1028,1049 ---- * In general, developers should use the {@code UIDefaults} returned from * {@code getDefaults()}. As the current look and feel may expect * certain values to exist, altering the {@code UIDefaults} returned * from this method could have unexpected results. * ! * @return {@code UIDefaults} from the current look and feel * @see #getDefaults * @see #setLookAndFeel(LookAndFeel) * @see LookAndFeel#getDefaults */ public static UIDefaults getLookAndFeelDefaults() { maybeInitialize(); return getLAFState().getLookAndFeelDefaults(); } /** ! * Finds the Multiplexing {@code LookAndFeel}. */ private static LookAndFeel getMultiLookAndFeel() { LookAndFeel multiLookAndFeel = getLAFState().multiLookAndFeel; if (multiLookAndFeel == null) { String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel";
*** 1057,1076 **** } return multiLookAndFeel; } /** ! * Adds a <code>LookAndFeel</code> to the list of auxiliary look and feels. * The auxiliary look and feels tell the multiplexing look and feel what ! * other <code>LookAndFeel</code> classes for a component instance are to be used ! * in addition to the default <code>LookAndFeel</code> class when creating a * multiplexing UI. The change will only take effect when a new * UI class is created or when the default look and feel is changed * on a component instance. * <p>Note these are not the same as the installed look and feels. * ! * @param laf the <code>LookAndFeel</code> object * @see #removeAuxiliaryLookAndFeel * @see #setLookAndFeel * @see #getAuxiliaryLookAndFeels * @see #getInstalledLookAndFeels */ --- 1057,1076 ---- } return multiLookAndFeel; } /** ! * Adds a {@code LookAndFeel} to the list of auxiliary look and feels. * The auxiliary look and feels tell the multiplexing look and feel what ! * other {@code LookAndFeel} classes for a component instance are to be used ! * in addition to the default {@code LookAndFeel} class when creating a * multiplexing UI. The change will only take effect when a new * UI class is created or when the default look and feel is changed * on a component instance. * <p>Note these are not the same as the installed look and feels. * ! * @param laf the {@code LookAndFeel} object * @see #removeAuxiliaryLookAndFeel * @see #setLookAndFeel * @see #getAuxiliaryLookAndFeels * @see #getInstalledLookAndFeels */
*** 1097,1117 **** } } } /** ! * Removes a <code>LookAndFeel</code> from the list of auxiliary look and feels. * The auxiliary look and feels tell the multiplexing look and feel what ! * other <code>LookAndFeel</code> classes for a component instance are to be used ! * in addition to the default <code>LookAndFeel</code> class when creating a * multiplexing UI. The change will only take effect when a new * UI class is created or when the default look and feel is changed * on a component instance. * <p>Note these are not the same as the installed look and feels. * * @param laf the {@code LookAndFeel} to be removed ! * @return true if the <code>LookAndFeel</code> was removed from the list * @see #removeAuxiliaryLookAndFeel * @see #getAuxiliaryLookAndFeels * @see #setLookAndFeel * @see #getInstalledLookAndFeels */ --- 1097,1117 ---- } } } /** ! * Removes a {@code LookAndFeel} from the list of auxiliary look and feels. * The auxiliary look and feels tell the multiplexing look and feel what ! * other {@code LookAndFeel} classes for a component instance are to be used ! * in addition to the default {@code LookAndFeel} class when creating a * multiplexing UI. The change will only take effect when a new * UI class is created or when the default look and feel is changed * on a component instance. * <p>Note these are not the same as the installed look and feels. * * @param laf the {@code LookAndFeel} to be removed ! * @return true if the {@code LookAndFeel} was removed from the list * @see #removeAuxiliaryLookAndFeel * @see #getAuxiliaryLookAndFeels * @see #setLookAndFeel * @see #getInstalledLookAndFeels */
*** 1138,1155 **** return result; } /** ! * Returns the list of auxiliary look and feels (can be <code>null</code>). * The auxiliary look and feels tell the multiplexing look and feel what ! * other <code>LookAndFeel</code> classes for a component instance are * to be used in addition to the default LookAndFeel class when creating a * multiplexing UI. * <p>Note these are not the same as the installed look and feels. * ! * @return list of auxiliary <code>LookAndFeel</code>s or <code>null</code> * @see #addAuxiliaryLookAndFeel * @see #removeAuxiliaryLookAndFeel * @see #setLookAndFeel * @see #getInstalledLookAndFeels */ --- 1138,1155 ---- return result; } /** ! * Returns the list of auxiliary look and feels (can be {@code null}). * The auxiliary look and feels tell the multiplexing look and feel what ! * other {@code LookAndFeel} classes for a component instance are * to be used in addition to the default LookAndFeel class when creating a * multiplexing UI. * <p>Note these are not the same as the installed look and feels. * ! * @return list of auxiliary {@code LookAndFeel}s or {@code null} * @see #addAuxiliaryLookAndFeel * @see #removeAuxiliaryLookAndFeel * @see #setLookAndFeel * @see #getInstalledLookAndFeels */
*** 1169,1182 **** } } /** ! * Adds a <code>PropertyChangeListener</code> to the listener list. * The listener is registered for all properties. * ! * @param listener the <code>PropertyChangeListener</code> to be added * @see java.beans.PropertyChangeSupport */ public static void addPropertyChangeListener(PropertyChangeListener listener) { synchronized (classLock) { --- 1169,1182 ---- } } /** ! * Adds a {@code PropertyChangeListener} to the listener list. * The listener is registered for all properties. * ! * @param listener the {@code PropertyChangeListener} to be added * @see java.beans.PropertyChangeSupport */ public static void addPropertyChangeListener(PropertyChangeListener listener) { synchronized (classLock) {
*** 1185,1199 **** } } /** ! * Removes a <code>PropertyChangeListener</code> from the listener list. ! * This removes a <code>PropertyChangeListener</code> that was registered * for all properties. * ! * @param listener the <code>PropertyChangeListener</code> to be removed * @see java.beans.PropertyChangeSupport */ public static void removePropertyChangeListener(PropertyChangeListener listener) { synchronized (classLock) { --- 1185,1199 ---- } } /** ! * Removes a {@code PropertyChangeListener} from the listener list. ! * This removes a {@code PropertyChangeListener} that was registered * for all properties. * ! * @param listener the {@code PropertyChangeListener} to be removed * @see java.beans.PropertyChangeSupport */ public static void removePropertyChangeListener(PropertyChangeListener listener) { synchronized (classLock) {
*** 1202,1215 **** } } /** ! * Returns an array of all the <code>PropertyChangeListener</code>s added * to this UIManager with addPropertyChangeListener(). * ! * @return all of the <code>PropertyChangeListener</code>s added or an empty * array if no listeners have been added * @since 1.4 */ public static PropertyChangeListener[] getPropertyChangeListeners() { synchronized(classLock) { --- 1202,1215 ---- } } /** ! * Returns an array of all the {@code PropertyChangeListener}s added * to this UIManager with addPropertyChangeListener(). * ! * @return all of the {@code PropertyChangeListener}s added or an empty * array if no listeners have been added * @since 1.4 */ public static PropertyChangeListener[] getPropertyChangeListeners() { synchronized(classLock) {
*** 1276,1288 **** } } /** ! * If a <code>swing.properties</code> file exist and it has a ! * <code>swing.installedlafs</code> property ! * then initialize the <code>installedLAFs</code> field. * * @see #getInstalledLookAndFeels */ private static void initializeInstalledLAFs(Properties swingProps) { --- 1276,1288 ---- } } /** ! * If a {@code swing.properties} file exist and it has a ! * {@code swing.installedlafs} property ! * then initialize the {@code installedLAFs} field. * * @see #getInstalledLookAndFeels */ private static void initializeInstalledLAFs(Properties swingProps) {
*** 1417,1427 **** } /* * This method is called before any code that depends on the ! * <code>AppContext</code> specific LAFState object runs. When the AppContext * corresponds to a set of applets it's possible for this method * to be re-entered, which is why we grab a lock before calling * initialize(). */ private static void maybeInitialize() { --- 1417,1427 ---- } /* * This method is called before any code that depends on the ! * {@code AppContext} specific LAFState object runs. When the AppContext * corresponds to a set of applets it's possible for this method * to be re-entered, which is why we grab a lock before calling * initialize(). */ private static void maybeInitialize() {
< prev index next >