javax.swing
Class UIDefaults
- Cloneable, Map<K,V>, Serializable
UIDefaults is a database where all settings and interface bindings are
stored into. A PLAF implementation fills one of these (see for example
plaf/basic/BasicLookAndFeel.java) with "ButtonUI" -> new BasicButtonUI().
static interface | UIDefaults.ActiveValue - Used for lazy instantiation of UIDefaults values so that they are not
all loaded when a Swing application starts up, but only the values that
are really needed.
|
static class | UIDefaults.LazyInputMap
|
static interface | UIDefaults.LazyValue - Used for lazy instantiation of UIDefaults values so that they are not
all loaded when a Swing application starts up, but only the values that
are really needed.
|
static class | UIDefaults.ProxyLazyValue
|
UIDefaults() - Constructs a new empty UIDefaults instance.
|
UIDefaults(Object[] entries) - Constructs a new UIDefaults instance and loads the specified entries.
|
void | addPropertyChangeListener(PropertyChangeListener listener) - Adds a
PropertyChangeListener to this UIDefaults map.
|
void | addResourceBundle(String name) - Adds a ResourceBundle for localized values.
|
Class | extends ComponentUI> getUIClass(String id) - Returns the ComponentUI class that renders a component.
|
Class | extends ComponentUI> getUIClass(String id, ClassLoader loader) - Returns the ComponentUI class that renders a component.
|
protected void | firePropertyChange(String property, Object oldValue, Object newValue) - Fires a PropertyChangeEvent.
|
Object | get(Object key) - Returns the entry for the specified
key in the default
locale.
|
Object | get(Object key, Locale loc) - Returns the entry for the specified
key in the Locale
loc .
|
boolean | getBoolean(Object key) - Returns a boolean entry for the default locale.
|
boolean | getBoolean(Object key, Locale locale) - Returns a boolean entry for a specic locale.
|
Border | getBorder(Object key) - Returns a border entry for the default locale.
|
Border | getBorder(Object key, Locale locale) - Returns a border entry for a specic locale.
|
Color | getColor(Object key) - Returns a color entry for the default locale.
|
Color | getColor(Object key, Locale locale) - Returns a color entry for a specic locale.
|
Locale | getDefaultLocale() - Returns the current default locale.
|
Dimension | getDimension(Object key) - Returns a dimension entry for the default locale.
|
Dimension | getDimension(Object key, Locale locale) - Returns a dimension entry for a specic locale.
|
Font | getFont(Object key) - Returns a font entry for the default locale.
|
Font | getFont(Object key, Locale locale) - Returns a font entry for a specic locale.
|
Icon | getIcon(Object key) - Returns an icon entry for the default locale.
|
Icon | getIcon(Object key, Locale locale) - Returns an icon entry for a specic locale.
|
Insets | getInsets(Object key) - Returns an insets entry for the default locale.
|
Insets | getInsets(Object key, Locale locale) - Returns an insets entry for a specic locale.
|
int | getInt(Object key) - Returns an integer entry for the default locale.
|
int | getInt(Object key, Locale locale) - Returns an integer entry for a specic locale.
|
PropertyChangeListener[] | getPropertyChangeListeners() - Returns an array of all registered PropertyChangeListeners.
|
String | getString(Object key) - Returns a string entry for the default locale.
|
String | getString(Object key, Locale locale) - Returns a string entry for a specic locale.
|
ComponentUI | getUI(JComponent target) - Returns the
ComponentUI for the specified JComponent .
|
protected void | getUIError(String msg) - If a key is requested in #get(key) that has no value, this method
is called before returning
null .
|
Object | put(Object key, Object value) - Puts a key and value into this UIDefaults object.
In contrast to
Hashtable s null -values are accepted
here and treated like #remove(key).
|
void | putDefaults(Object[] entries) - Puts a set of key-value pairs into the map.
|
void | removePropertyChangeListener(PropertyChangeListener listener) - Removes a PropertyChangeListener from this UIDefaults map.
|
void | removeResourceBundle(String name) - Removes a ResourceBundle.
|
void | setDefaultLocale(Locale loc) - Sets the current locale to
loc .
|
V>> entrySet , clear , clone , contains , containsKey , containsValue , elements , equals , get , hashCode , isEmpty , keySet , keys , put , putAll , rehash , remove , size , toString , values |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
UIDefaults
public UIDefaults()
Constructs a new empty UIDefaults instance.
UIDefaults
public UIDefaults(Object[] entries)
Constructs a new UIDefaults instance and loads the specified entries.
The entries are expected to come in pairs, that means
entries[0]
is a key, entries[1]
is a value,
entries[2]
a key and so forth.
entries
- the entries to initialize the UIDefaults instance with
addResourceBundle
public void addResourceBundle(String name)
Adds a ResourceBundle for localized values.
name
- the name of the ResourceBundle to add
extends ComponentUI> getUIClass
public Class extends ComponentUI> getUIClass(String id)
Returns the ComponentUI class that renders a component. id
is the ID for which the String value of the classname is stored in
this UIDefaults map.
id
- the ID of the UI class
extends ComponentUI> getUIClass
public Class extends ComponentUI> getUIClass(String id,
ClassLoader loader)
Returns the ComponentUI class that renders a component. id
is the ID for which the String value of the classname is stored in
this UIDefaults map.
id
- the ID of the UI classloader
- the ClassLoader to use
firePropertyChange
protected void firePropertyChange(String property,
Object oldValue,
Object newValue)
Fires a PropertyChangeEvent.
property
- the property nameoldValue
- the old valuenewValue
- the new value
get
public Object get(Object key,
Locale loc)
Returns the entry for the specified key
in the Locale
loc
.
key
- the key for which we return the valueloc
- the locale
getBoolean
public boolean getBoolean(Object key)
Returns a boolean entry for the default locale.
key
- the key to the requested entry
- The boolean entry for
key
or false
if no
such entry exists.
getBoolean
public boolean getBoolean(Object key,
Locale locale)
Returns a boolean entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the boolean entry for
key
or null if no such entry
exists
getBorder
public Border getBorder(Object key)
Returns a border entry for the default locale.
key
- the key to the requested entry
- the border entry for
key
or null if no such entry
exists
getBorder
public Border getBorder(Object key,
Locale locale)
Returns a border entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the border entry for
key
or null if no such entry
exists
getColor
public Color getColor(Object key)
Returns a color entry for the default locale.
key
- the key to the requested entry
- the color entry for
key
or null if no such entry
exists
getColor
public Color getColor(Object key,
Locale locale)
Returns a color entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the color entry for
key
or null if no such entry
exists
getDefaultLocale
public Locale getDefaultLocale()
Returns the current default locale.
- the current default locale
getDimension
public Dimension getDimension(Object key)
Returns a dimension entry for the default locale.
key
- the key to the requested entry
- the dimension entry for
key
or null if no such entry
exists
getDimension
public Dimension getDimension(Object key,
Locale locale)
Returns a dimension entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the boolean entry for
key
or null if no such entry
exists
getFont
public Font getFont(Object key)
Returns a font entry for the default locale.
key
- the key to the requested entry
- the font entry for
key
or null if no such entry
exists
getFont
public Font getFont(Object key,
Locale locale)
Returns a font entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the font entry for
key
or null if no such entry
exists
getIcon
public Icon getIcon(Object key)
Returns an icon entry for the default locale.
key
- the key to the requested entry
- the icon entry for
key
or null if no such entry
exists
getIcon
public Icon getIcon(Object key,
Locale locale)
Returns an icon entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the icon entry for
key
or null if no such entry
exists
getInsets
public Insets getInsets(Object key)
Returns an insets entry for the default locale.
key
- the key to the requested entry
- the insets entry for
key
or null if no such entry
exists
getInsets
public Insets getInsets(Object key,
Locale locale)
Returns an insets entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the boolean entry for
key
or null if no such entry
exists
getInt
public int getInt(Object key)
Returns an integer entry for the default locale.
key
- the key to the requested entry
- the integer entry for
key
or null if no such entry
exists
getInt
public int getInt(Object key,
Locale locale)
Returns an integer entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the integer entry for
key
or null if no such entry
exists
getString
public String getString(Object key)
Returns a string entry for the default locale.
key
- the key to the requested entry
- the string entry for
key
or null if no such entry
exists
getString
public String getString(Object key,
Locale locale)
Returns a string entry for a specic locale.
key
- the key to the requested entrylocale
- the locale to the requested entry
- the string entry for
key
or null if no such entry
exists
getUIError
protected void getUIError(String msg)
If a key is requested in #get(key) that has no value, this method
is called before returning null
.
put
public Object put(Object key,
Object value)
Puts a key and value into this UIDefaults object.
In contrast to
Hashtable
s
null
-values are accepted
here and treated like #remove(key).
This fires a PropertyChangeEvent with key as name and the old and new
values.
key
- the key to put into the mapvalue
- the value to put into the map
- the old value for key or
null
if key
had no value assigned
putDefaults
public void putDefaults(Object[] entries)
Puts a set of key-value pairs into the map.
The entries are expected to come in pairs, that means
entries[0]
is a key, entries[1]
is a value,
entries[2]
a key and so forth.
If a value is null
it is treated like #remove(key).
This unconditionally fires a PropertyChangeEvent with
'UIDefaults'
as name and null
for
old and new value.
entries
- the entries to be put into the map
removeResourceBundle
public void removeResourceBundle(String name)
Removes a ResourceBundle.
name
- the name of the ResourceBundle to remove
setDefaultLocale
public void setDefaultLocale(Locale loc)
Sets the current locale to loc
.
loc
- the Locale to be set
UIDefaults.java -- database for all settings and interface bindings.
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.