summaryrefslogtreecommitdiff
path: root/javax/swing/UIManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/UIManager.java')
-rw-r--r--javax/swing/UIManager.java109
1 files changed, 107 insertions, 2 deletions
diff --git a/javax/swing/UIManager.java b/javax/swing/UIManager.java
index d7ebad9a5..5d8a0f763 100644
--- a/javax/swing/UIManager.java
+++ b/javax/swing/UIManager.java
@@ -44,6 +44,7 @@ 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 +159,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 +206,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 +224,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 +256,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 +277,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 +298,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 +313,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 +334,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 +365,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.