Package com.jidesoft.plaf
Class UIDefaultsLookup
- java.lang.Object
-
- com.jidesoft.plaf.UIDefaultsLookup
-
public class UIDefaultsLookup extends java.lang.Object
This class simply uses UIManager's get method to lookup the UIDefaults. We used this everywhere in our code so that we have one central place to find out which UIDefaults we are using. Another good thing is you can usesetTrace(boolean)
andsetDebug(boolean)
to turn on the trace so that it will print out which UIDefaults we are trying to get.
-
-
Constructor Summary
Constructors Constructor Description UIDefaultsLookup()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
get(java.lang.Object key)
static java.lang.Object
get(java.lang.Object key, java.util.Locale l)
static boolean
getBoolean(java.lang.Object key)
If the value ofkey
is boolean, return the boolean value, otherwise return false.static boolean
getBoolean(java.lang.Object key, boolean defaultValue)
If the value ofkey
is boolean, return the boolean value, otherwise return false.static boolean
getBoolean(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is boolean, return the boolean value, otherwise return false.static javax.swing.border.Border
getBorder(java.lang.Object key)
If the value ofkey
is aBorder
return it, otherwise returnnull
.static javax.swing.border.Border
getBorder(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aBorder
return it, otherwise returnnull
.static java.awt.Color
getColor(java.lang.Object key)
If the value ofkey
is aColor
return it, otherwise returnnull
.static java.awt.Color
getColor(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aColor
return it, otherwise returnnull
.static java.awt.Dimension
getDimension(java.lang.Object key)
If the value ofkey
is aDimension
return it, otherwise returnnull
.static java.awt.Dimension
getDimension(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aDimension
return it, otherwise returnnull
.static java.awt.Font
getFont(java.lang.Object key)
If the value ofkey
is aFont
return it, otherwise returnnull
.static java.awt.Font
getFont(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aFont
return it, otherwise returnnull
.static javax.swing.Icon
getIcon(java.lang.Object key)
If the value ofkey
is anIcon
return it, otherwise returnnull
.static javax.swing.Icon
getIcon(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is anIcon
return it, otherwise returnnull
.static java.awt.Insets
getInsets(java.lang.Object key)
If the value ofkey
is anInsets
return it, otherwise returnnull
.static java.awt.Insets
getInsets(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is anInsets
return it, otherwise returnnull
.static int
getInt(java.lang.Object key)
If the value ofkey
is anInteger
return its integer value, otherwise return 0.static int
getInt(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is anInteger
return its integer value, otherwise return 0.static java.lang.String
getString(java.lang.Object key)
If the value ofkey
is aString
return it, otherwise returnnull
.static java.lang.String
getString(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aString
return it, otherwise returnnull
.static void
put(javax.swing.UIDefaults table, java.lang.String key, java.lang.Object value)
static void
setDebug(boolean debug)
Sets the debug mode.static void
setTrace(boolean trace)
Sets the trace mode.
-
-
-
Method Detail
-
setDebug
public static void setDebug(boolean debug)
Sets the debug mode. If debug mode is on, we will print out any UIDefaults that the value is null.- Parameters:
debug
- true or false.
-
setTrace
public static void setTrace(boolean trace)
Sets the trace mode. If trace mode is on, we will print out any UIDefaults we are trying to get and its current value.- Parameters:
trace
- true or false.
-
put
public static void put(javax.swing.UIDefaults table, java.lang.String key, java.lang.Object value)
-
get
public static java.lang.Object get(java.lang.Object key)
-
get
public static java.lang.Object get(java.lang.Object key, java.util.Locale l)
-
getFont
public static java.awt.Font getFont(java.lang.Object key)
If the value ofkey
is aFont
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is aFont
, return theFont
object; otherwise returnnull
-
getFont
public static java.awt.Font getFont(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aFont
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is aFont
, return theFont
object; otherwise returnnull
- Since:
- 1.9.5.04
-
getColor
public static java.awt.Color getColor(java.lang.Object key)
If the value ofkey
is aColor
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is aColor
, return theColor
object; otherwise returnnull
-
getColor
public static java.awt.Color getColor(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aColor
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is aColor
, return theColor
object; otherwise returnnull
- Since:
- 1.9.5.04
-
getIcon
public static javax.swing.Icon getIcon(java.lang.Object key)
If the value ofkey
is anIcon
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is anIcon
, return theIcon
object; otherwise returnnull
-
getIcon
public static javax.swing.Icon getIcon(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is anIcon
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is anIcon
, return theIcon
object; otherwise returnnull
- Since:
- 1.9.5.04
-
getBorder
public static javax.swing.border.Border getBorder(java.lang.Object key)
If the value ofkey
is aBorder
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is aBorder
, return theBorder
object; otherwise returnnull
-
getBorder
public static javax.swing.border.Border getBorder(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aBorder
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is aBorder
, return theBorder
object; otherwise returnnull
- Since:
- 1.9.5.04
-
getString
public static java.lang.String getString(java.lang.Object key)
If the value ofkey
is aString
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is aString
, return theString
object; otherwise returnnull
-
getString
public static java.lang.String getString(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aString
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desiredLocale
- Returns:
- if the value for
key
for the givenLocale
is aString
, return theString
object; otherwise returnnull
- Since:
- 1.9.5.04
-
getInt
public static int getInt(java.lang.Object key)
If the value ofkey
is anInteger
return its integer value, otherwise return 0.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is anInteger
, return its value, otherwise return 0
-
getInt
public static int getInt(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is anInteger
return its integer value, otherwise return 0.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is anInteger
, return its value, otherwise return 0 - Since:
- 1.9.5.04
-
getBoolean
public static boolean getBoolean(java.lang.Object key)
If the value ofkey
is boolean, return the boolean value, otherwise return false.- Parameters:
key
- anObject
specifying the key for the desired boolean value- Returns:
- if the value of
key
is boolean, return the boolean value, otherwise return false. - Since:
- 1.9.5.04
-
getBoolean
public static boolean getBoolean(java.lang.Object key, boolean defaultValue)
If the value ofkey
is boolean, return the boolean value, otherwise return false.- Parameters:
key
- anObject
specifying the key for the desired boolean valuedefaultValue
- the default value if the key is missing- Returns:
- if the value of
key
is boolean, return the boolean value, otherwise return false.
-
getBoolean
public static boolean getBoolean(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is boolean, return the boolean value, otherwise return false.- Parameters:
key
- anObject
specifying the key for the desired boolean valuel
- the desired locale- Returns:
- if the value for
key
andLocale
is boolean, return the boolean value, otherwise return false. - Since:
- 1.9.5.04
-
getInsets
public static java.awt.Insets getInsets(java.lang.Object key)
If the value ofkey
is anInsets
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is anInsets
, return theInsets
object; otherwise returnnull
-
getInsets
public static java.awt.Insets getInsets(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is anInsets
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is anInsets
, return theInsets
object; otherwise returnnull
- Since:
- 1.9.5.04
-
getDimension
public static java.awt.Dimension getDimension(java.lang.Object key)
If the value ofkey
is aDimension
return it, otherwise returnnull
.- Parameters:
key
- the desired key- Returns:
- if the value for
key
is aDimension
, return theDimension
object; otherwise returnnull
-
getDimension
public static java.awt.Dimension getDimension(java.lang.Object key, java.util.Locale l)
If the value ofkey
for the givenLocale
is aDimension
return it, otherwise returnnull
.- Parameters:
key
- the desired keyl
- the desired locale- Returns:
- if the value for
key
andLocale
is aDimension
, return theDimension
object; otherwise returnnull
- Since:
- 1.9.5.04
-
-