diff options
Diffstat (limited to 'libjava/javax/swing/UIManager.java')
-rw-r--r-- | libjava/javax/swing/UIManager.java | 110 |
1 files changed, 108 insertions, 2 deletions
diff --git a/libjava/javax/swing/UIManager.java b/libjava/javax/swing/UIManager.java index a600972..9722129 100644 --- a/libjava/javax/swing/UIManager.java +++ b/libjava/javax/swing/UIManager.java @@ -44,6 +44,8 @@ import java.awt.Font; import java.awt.Insets; import java.beans.PropertyChangeListener; import java.io.Serializable; +import java.util.Locale; + import javax.swing.border.Border; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.metal.MetalLookAndFeel; @@ -158,10 +160,43 @@ public class UIManager implements Serializable } public static LookAndFeel[] getAuxiliaryLookAndFeels() - { return aux_installed; } + { + return aux_installed; + } public static Object get(Object key) - { return getLookAndFeel().getDefaults().get(key); } + { + return getLookAndFeel().getDefaults().get(key); + } + + public static Object get(Object key, Locale locale) + { + return getLookAndFeel().getDefaults().get(key ,locale); + } + + /** + * Returns a boolean value from the defaults table, + * <code>false</code> if key is not present. + * + * @since 1.4 + */ + public static boolean getBoolean(Object key) + { + Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key); + return value != null ? value.booleanValue() : false; + } + + /** + * Returns a boolean value from the defaults table, + * <code>false</code> if key is not present. + * + * @since 1.4 + */ + public static boolean getBoolean(Object key, Locale locale) + { + Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key, locale); + return value != null ? value.booleanValue() : false; + } /** * Returns a border from the defaults table. @@ -172,6 +207,16 @@ public class UIManager implements Serializable } /** + * Returns a border from the defaults table. + * + * @since 1.4 + */ + public static Border getBorder(Object key, Locale locale) + { + return (Border) getLookAndFeel().getDefaults().get(key, locale); + } + + /** * Returns a drawing color from the defaults table. */ public static Color getColor(Object key) @@ -180,6 +225,14 @@ public class UIManager implements Serializable } /** + * Returns a drawing color from the defaults table. + */ + public static Color getColor(Object key, Locale locale) + { + return (Color) getLookAndFeel().getDefaults().get(key); + } + + /** * this string can be passed to Class.forName() */ public static String getCrossPlatformLookAndFeelClassName() @@ -204,6 +257,14 @@ public class UIManager implements Serializable } /** + * Returns a dimension from the defaults table. + */ + public static Dimension getDimension(Object key, Locale locale) + { + return (Dimension) getLookAndFeel().getDefaults().get(key, locale); + } + + /** * Retrieves a font from the defaults table of the current * LookAndFeel. * @@ -217,6 +278,19 @@ public class UIManager implements Serializable } /** + * Retrieves a font from the defaults table of the current + * LookAndFeel. + * + * @param key an Object that specifies the font. Typically, + * this is a String such as + * <code>TitledBorder.font</code>. + */ + public static Font getFont(Object key, Locale locale) + { + return (Font) getLookAndFeel().getDefaults().get(key ,locale); + } + + /** * Returns an Icon from the defaults table. */ public static Icon getIcon(Object key) @@ -225,6 +299,14 @@ public class UIManager implements Serializable } /** + * Returns an Icon from the defaults table. + */ + public static Icon getIcon(Object key, Locale locale) + { + return (Icon) getLookAndFeel().getDefaults().get(key, locale); + } + + /** * Returns an Insets object from the defaults table. */ public static Insets getInsets(Object key) @@ -232,6 +314,14 @@ public class UIManager implements Serializable return (Insets) getLookAndFeel().getDefaults().getInsets(key); } + /** + * Returns an Insets object from the defaults table. + */ + public static Insets getInsets(Object key, Locale locale) + { + return (Insets) getLookAndFeel().getDefaults().getInsets(key, locale); + } + public static LookAndFeelInfo[] getInstalledLookAndFeels() { return installed; @@ -245,6 +335,14 @@ public class UIManager implements Serializable return x.intValue(); } + public static int getInt(Object key, Locale locale) + { + Integer x = (Integer) getLookAndFeel().getDefaults().get(key, locale); + if (x == null) + return 0; + return x.intValue(); + } + public static LookAndFeel getLookAndFeel() { return look_and_feel; @@ -268,6 +366,14 @@ public class UIManager implements Serializable } /** + * Returns a string from the defaults table. + */ + public static String getString(Object key, Locale locale) + { + return (String) getLookAndFeel().getDefaults().get(key, locale); + } + + /** * 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. |