public class UIManager extends Object
Modifier and Type | Method and Description |
---|---|
void |
addThemeProps(Hashtable themeProps)
Adds the given theme properties on top of the existing properties without
clearing the existing theme first
|
void |
addThemeRefreshListener(ActionListener l)
Adds a Theme refresh listener.
|
static UIManager |
createInstance()
This factory method allows creating a new UIManager instance, this is usefull where an application
has some screens with different context
|
Map<String,String> |
getBundle()
The resource bundle allows us to implicitly localize the UI on the fly, once its
installed all internal application strings query the resource bundle and extract
their values from this table if applicable.
|
Style |
getComponentCustomStyle(String id,
String type)
Returns a custom style for the component with the given id, this method always returns a
new instance.
|
Style |
getComponentSelectedStyle(String id)
Returns the selected style of the component with the given id or a new instance of the default
style.
|
Style |
getComponentStyle(String id)
Returns the style of the component with the given id or a new instance of the default
style.
|
static UIManager |
getInstance()
Singleton instance method
|
LookAndFeel |
getLookAndFeel()
Returns the currently installed look and feel
|
Hashtable |
getResourceBundle()
Deprecated.
this method uses the old resource bundle hashtable, use the new getBundle() method
|
int |
getThemeConstant(String constantName,
int def)
Returns a theme constant defined in the resource editor
|
String |
getThemeConstant(String constantName,
String def)
Returns a theme constant defined in the resource editor
|
Image |
getThemeImageConstant(String constantName)
Returns a theme constant defined in the resource editor
|
Object |
getThemeMaskConstant(String constantName)
Returns a theme mask constant
|
String |
getThemeName() |
Boolean |
isThemeConstant(String constantName)
Returns a theme constant defined in the resource editor as a boolean value or null if the constant isn't defined
|
boolean |
isThemeConstant(String constantName,
boolean def)
Returns a theme constant defined in the resource editor as a boolean value
|
String |
localize(String key,
String defaultValue)
Localizes the given string from the resource bundle if such a String exists in the
resource bundle.
|
void |
removeThemeRefreshListener(ActionListener l)
Removes a Theme refresh listener.
|
void |
setBundle(Map<String,String> bundle)
The resource bundle allows us to implicitly localize the UI on the fly, once its
installed all internal application strings query the resource bundle and extract
their values from this table if applicable.
|
void |
setComponentSelectedStyle(String id,
Style style)
Allows a developer to programmatically install a style into the UI manager
|
void |
setComponentStyle(String id,
Style style)
Allows a developer to programmatically install a style into the UI manager
|
void |
setComponentStyle(String id,
Style style,
String type)
Allows a developer to programmatically install a style into the UI manager
|
void |
setLookAndFeel(LookAndFeel plaf)
Sets the currently installed look and feel
|
void |
setResourceBundle(Hashtable resourceBundle)
Deprecated.
this method uses the old resource bundle hashtable, use the new setBundle() method
|
void |
setThemeProps(Hashtable themeProps)
Allows manual theme loading from a hashtable of key/value pairs
|
boolean |
wasThemeInstalled()
Indicates if a theme was previously installed since the last reset
|
public boolean wasThemeInstalled()
public static UIManager getInstance()
public static UIManager createInstance()
Formt#setUIManager(UIManager)
public LookAndFeel getLookAndFeel()
public void setLookAndFeel(LookAndFeel plaf)
plaf
- the look and feel for the applicationpublic void setComponentStyle(String id, Style style)
id
- the component id matching the given stylestyle
- the style object to installpublic void setComponentStyle(String id, Style style, String type)
id
- the component id matching the given stylestyle
- the style object to installtype
- press, dis or other custom typepublic void setComponentSelectedStyle(String id, Style style)
id
- the component id matching the given stylestyle
- the style object to installpublic Style getComponentStyle(String id)
id
- the component id whose style we wantpublic Style getComponentSelectedStyle(String id)
id
- the component id whose selected style we wantpublic Style getComponentCustomStyle(String id, String type)
id
- the component id whose custom style we wanttype
- the style typepublic String getThemeName()
public void setThemeProps(Hashtable themeProps)
themeProps
- the properties of the given themepublic void addThemeProps(Hashtable themeProps)
themeProps
- the properties of the given themepublic int getThemeConstant(String constantName, int def)
constantName
- the name of the constantdef
- default valuepublic String getThemeConstant(String constantName, String def)
constantName
- the name of the constantdef
- default valuepublic boolean isThemeConstant(String constantName, boolean def)
constantName
- the name of the constantdef
- default valuepublic Boolean isThemeConstant(String constantName)
constantName
- the name of the constantpublic Image getThemeImageConstant(String constantName)
constantName
- the name of the constantpublic Object getThemeMaskConstant(String constantName)
constantName
- the name of the constantpublic Hashtable getResourceBundle()
public Map<String,String> getBundle()
public void setBundle(Map<String,String> bundle)
resourceBundle
- the localization bundlepublic void setResourceBundle(Hashtable resourceBundle)
resourceBundle
- the localization bundlepublic String localize(String key, String defaultValue)
key
- The key used to lookup in the resource bundledefaultValue
- the value returned if no such key existspublic void addThemeRefreshListener(ActionListener l)
l
- an ActionListener to be addedpublic void removeThemeRefreshListener(ActionListener l)
l
- an ActionListener to be removed