UIManager.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder
.
Object[] uiDefaults = {
"Font", new Font("Dialog", Font.BOLD, 12),
"Color", Color.red,
"five", new Integer(5)
}
UIDefaults myDefaults = new UIDefaults(uiDefaults);
PropertyChangeListener to the listener list.
The listener is registered for all properties.
A PropertyChangeEvent will get fired whenever a default
is changed.
containsKey
method.Note that this method is identical in functionality to containsValue, (which is part of the Map interface in the collections framework).
Note that this method is identical in functionality to contains (which predates the Map interface).
UIDefaults.LazyValue then the real
value is computed with LazyValue.createValue(),
the table entry is replaced, and the real value is returned.
If the value is an UIDefaults.ActiveValue
the table entry is not replaced - the value is computed
with ActiveValue.createValue() for each
get() call.
If the key is not found in the table then it is searched for in the list
of resource bundles maintained by this object. The resource bundles are
searched most recently added first using the locale returned by
getDefaultLocale. LazyValues and
ActiveValues are not supported in the resource bundles.UIDefaults.LazyValue then the real
value is computed with LazyValue.createValue(),
the table entry is replaced, and the real value is returned.
If the value is an UIDefaults.ActiveValue
the table entry is not replaced - the value is computed
with ActiveValue.createValue() for each
get() call.
If the key is not found in the table then it is searched for in the list
of resource bundles maintained by this object. The resource bundles are
searched most recently added first using the given locale.
LazyValues and ActiveValues are not supported
in the resource bundles.key is boolean, return the
boolean value, otherwise return false.key for the given Locale
is boolean, return the boolean value, otherwise return false.key is a Border return it,
otherwise return null.key for the given Locale
is a Border return it, otherwise return null.key is a Color return it,
otherwise return null.key for the given Locale
is a Color return it, otherwise return null.get methods that do not take a
locale argument. As of release 1.4, Swing UI objects should retrieve
localized values using the locale of their component rather than the
default locale. The default locale exists to provide compatibility with
pre 1.4 behaviour.key is a Dimension return it,
otherwise return null.key for the given Locale
is a Dimension return it, otherwise return null.key is a Font return it,
otherwise return null.key for the given Locale
is a Font return it, otherwise return null.key is an Icon return it,
otherwise return null.key for the given Locale
is an Icon return it, otherwise return null.key is an Insets return it,
otherwise return null.key for the given Locale
is an Insets return it, otherwise return null.key is an Integer return its
integer value, otherwise return 0.key for the given Locale
is an Integer return its integer value, otherwise return 0.PropertyChangeListeners added
to this UIDefaults with addPropertyChangeListener().key is a String return it,
otherwise return null.key for the given Locale
is a String return it, otherwise return null.ComponentUI implementation for the
specified component. In other words create the look
and feel specific delegate object for target.
This is done in two steps:
ComponentUI implementation
class under the value returned by target.getUIClassID().
createUI()
method to construct a look and feel delegate.
get(uidClassID) must be the
String name of a
class that implements the corresponding ComponentUI
class. If the class hasn't been loaded before, this method looks
up the class with uiClassLoader.loadClass() if a non
null
class loader is provided, classForName() otherwise.
If a mapping for uiClassID exists or if the specified
class can't be found, return null.
This method is used by getUI, it's usually
not necessary to call it directly.
wait methods.
The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object. The awakened thread will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened thread enjoys no reliable privilege or disadvantage in being the next thread to lock this object.
This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:
synchronized statement
that synchronizes on the object.
Class, by executing a
synchronized static method of that class.
Only one thread at a time can own an object's monitor.
wait methods.
The awakened threads will not be able to proceed until the current thread relinquishes the lock on this object. The awakened threads will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened threads enjoy no reliable privilege or disadvantage in being the next thread to lock this object.
This method should only be called by a thread that is the owner
of this object's monitor. See the notify method for a
description of the ways in which a thread can become the owner of
a monitor.
key to value for all locales.
If key is a string and the new value isn't
equal to the old one, fire a PropertyChangeEvent.
If value is null, the key is removed from the table.PropertyChangeEvent.
The events oldValue and newValue will be null and its
propertyName will be "UIDefaults". The key/value pairs are
added for all locales.PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.get methods that do not take a
locale argument. As of release 1.4, Swing UI objects should retrieve
localized values using the locale of their component rather than the
default locale. The default locale exists to provide compatibility with
pre 1.4 behaviour.Overrides to toString method of Object.
The current thread must own this object's monitor. The thread
releases ownership of this monitor and waits until another thread
notifies threads waiting on this object's monitor to wake up
either through a call to the notify method or the
notifyAll method. The thread then waits until it can
re-obtain ownership of the monitor and resumes execution.
As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:
synchronized (obj) {
while (<condition does not hold>)
obj.wait();
... // Perform action appropriate to condition
}
This method should only be called by a thread that is the owner
of this object's monitor. See the notify method for a
description of the ways in which a thread can become the owner of
a monitor.The current thread must own this object's monitor.
This method causes the current thread (call it T) to place itself in the wait set for this object and then to relinquish any and all synchronization claims on this object. Thread T becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
A thread can also wake up without being notified, interrupted, or timing out, a so-called spurious wakeup. While this will rarely occur in practice, applications must guard against it by testing for the condition that should have caused the thread to be awakened, and continuing to wait if the condition is not satisfied. In other words, waits should always occur in loops, like this one:
synchronized (obj) {
while (<condition does not hold>)
obj.wait(timeout);
... // Perform action appropriate to condition
}
(For more information on this topic, see Section 3.2.3 in Doug Lea's
"Concurrent Programming in Java (Second Edition)" (Addison-Wesley,
2000), or Item 50 in Joshua Bloch's "Effective Java Programming
Language Guide" (Addison-Wesley, 2001).
If the current thread is interrupted by another thread while it is waiting, then an InterruptedException is thrown. This exception is not thrown until the lock status of this object has been restored as described above.
Note that the wait method, as it places the current thread into the wait set for this object, unlocks only this object; any other objects on which the current thread may be synchronized remain locked while the thread waits.
This method should only be called by a thread that is the owner
of this object's monitor. See the notify method for a
description of the ways in which a thread can become the owner of
a monitor.
This method is similar to the wait method of one
argument, but it allows finer control over the amount of time to
wait for a notification before giving up. The amount of real time,
measured in nanoseconds, is given by:
1000000*timeout+nanos
In all other respects, this method does the same thing as the method of one argument. In particular, wait(0, 0) means the same thing as wait(0).
The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until either of the following two conditions has occurred:
notify method
or the notifyAll method.
timeout
milliseconds plus nanos nanoseconds arguments, has
elapsed.
The thread then waits until it can re-obtain ownership of the monitor and resumes execution.
As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:
synchronized (obj) {
while (<condition does not hold>)
obj.wait(timeout, nanos);
... // Perform action appropriate to condition
}
This method should only be called by a thread that is the owner
of this object's monitor. See the notify method for a
description of the ways in which a thread can become the owner of
a monitor.