public class BaseIconTheme extends Object implements IconTheme
This class represents an icon theme, which is basically a mapping of symbolic icon names, and real icons (or icon paths). This is useful to change an application's icons in an easy way. An icon theme is usually read from disk on start up, but can also be created or modified on a later time.
IconTheme.Icon
Modifier and Type | Field and Description |
---|---|
protected String |
defaultIconName |
protected IconTheme |
defaultTheme |
protected String |
description |
protected Map<String,IconTheme.Icon> |
iconList |
protected String |
id |
protected static Logger |
logger |
protected String |
name |
NO_ICON_NAME
Constructor and Description |
---|
BaseIconTheme() |
BaseIconTheme(IconTheme defaultIconTheme) |
Modifier and Type | Method and Description |
---|---|
protected void |
deferredLoad()
Override this to load icons on demand instead of
load on the creation of the theme.
|
boolean |
exists(String iconName)
Returns
true if the icon theme contains a mapping for the
specified iconName. |
void |
export(File folder) |
ImageIcon |
get(String name)
Gets the ImageIcon associated with the provided name, if the name
is present in the theme.
|
ImageIcon |
get(String iconName,
ClassLoader loader)
Deprecated.
use get(String iconName) instead.
|
IconTheme |
getDefault() |
ImageIcon |
getDefaultIcon()
Return the icon used as icon by default when the requested icon
not exists.
|
String |
getDescription()
Gets the theme description.
|
String |
getID() |
String |
getName()
Gets the theme name of the theme
|
ImageIcon |
getNoIcon()
Deprecated.
use getDefaultIcon
|
IconTheme.Icon |
getThemeIcon(String name)
Return the ThemeIcon associated with the name.
|
Iterator<IconTheme.Icon> |
getThemeIcons()
Return an iterator over the ThemIcon in the theme.
|
Iterator<String> |
iterator()
Return an iterator over the names of the icons in the theme.
|
void |
load(Object resource)
Load the icons of the theme
|
void |
register(String name,
ImageIcon image)
Deprecated.
use
#registerDefault(PluginServices, String, String, ImageIcon, Object) |
void |
register(String name,
Object resource)
Deprecated.
use
#registerDefault(PluginServices, String, String, ImageIcon, Object) |
void |
register(String provider,
String group,
String name,
ImageIcon icon,
URL resource)
Register a icon in the theme.
|
void |
registerDefault(String name,
ImageIcon image)
Deprecated.
use
#registerDefault(PluginServices, String, String, ImageIcon, Object) |
void |
registerDefault(String name,
Object resource)
Deprecated.
use
#registerDefault(PluginServices, String, String, ImageIcon, Object) |
void |
registerDefault(String provider,
String group,
String name,
ImageIcon icon,
URL resource)
Register a icon in the theme.
|
void |
setDefault(IconTheme def) |
void |
setDefaultIcon(ImageIcon icon)
Set the default icon to use when the requestd icon not exists.
|
void |
setDefaultIcon(String name) |
void |
setDefaultIcon(URL resource) |
void |
setDescription(String description)
Sets the theme description.
|
void |
setID(String id) |
void |
setName(String themeName)
Sets the theme name of the theme
|
String |
toString()
Returns the name of the icon theme
|
protected static Logger logger
protected String id
protected String name
protected String description
protected Map<String,IconTheme.Icon> iconList
protected IconTheme defaultTheme
protected String defaultIconName
public BaseIconTheme()
public BaseIconTheme(IconTheme defaultIconTheme)
public void load(Object resource)
protected void deferredLoad()
public void setDefault(IconTheme def)
setDefault
in interface IconTheme
public IconTheme getDefault()
getDefault
in interface IconTheme
public boolean exists(String iconName)
IconTheme
true
if the icon theme contains a mapping for the
specified iconName.public Iterator<String> iterator()
IconTheme
public Iterator<IconTheme.Icon> getThemeIcons()
IconTheme
getThemeIcons
in interface IconTheme
public IconTheme.Icon getThemeIcon(String name)
IconTheme
getThemeIcon
in interface IconTheme
name
- of the iconpublic ImageIcon get(String name)
IconTheme
null
if
this not exists.public String getName()
IconTheme
public void setName(String themeName)
IconTheme
public String getDescription()
IconTheme
getDescription
in interface IconTheme
public void setDescription(String description)
IconTheme
setDescription
in interface IconTheme
public String toString()
public ImageIcon getDefaultIcon()
IconTheme
getDefaultIcon
in interface IconTheme
public void setDefaultIcon(ImageIcon icon)
IconTheme
setDefaultIcon
in interface IconTheme
public void setDefaultIcon(URL resource)
setDefaultIcon
in interface IconTheme
public void setDefaultIcon(String name)
setDefaultIcon
in interface IconTheme
public void register(String provider, String group, String name, ImageIcon icon, URL resource)
IconTheme
public void registerDefault(String provider, String group, String name, ImageIcon icon, URL resource)
IconTheme
registerDefault
in interface IconTheme
provider
- name of the icongroup
- name for the icon.name
- of iconpublic ImageIcon getNoIcon()
public void registerDefault(String name, ImageIcon image)
#registerDefault(PluginServices, String, String, ImageIcon, Object)
registerDefault
in interface IconTheme
public void registerDefault(String name, Object resource)
#registerDefault(PluginServices, String, String, ImageIcon, Object)
registerDefault
in interface IconTheme
public void register(String name, ImageIcon image)
#registerDefault(PluginServices, String, String, ImageIcon, Object)
public void register(String name, Object resource)
#registerDefault(PluginServices, String, String, ImageIcon, Object)
public ImageIcon get(String iconName, ClassLoader loader)