TopBlend:
Here is the
first difference.
There are 3 differences.
is old.
is new.
javax.swing
Class LookAndFeel
java.lang.Object
javax.swing.LookAndFeel
-
Direct Known Subclasses:
-
BasicLookAndFeel
,
MultiLookAndFeel
-
public abstract class
LookAndFeel
-
extends
Object
Completely characterizes a look and feel from the point of view of the pluggable look and feel components.
Method Summary
|
UIDefaults
|
getDefaults
()
This method is called once by UIManager.setLookAndFeel to create the look and feel specific defaults table. |
abstract
String
|
getDescription
()
Return a one line description of this look and feel implementation, e.g. |
static
Object
|
getDesktopPropertyValue
(
String
systemPropertyName,
Object
fallbackValue)
Returns the value of the specified system desktop property by invoking Toolkit.getDefaultToolkit().getDesktopProperty(). |
abstract
String
|
getID
()
Return a string that identifies this look and feel. |
abstract
String
|
getName
()
Return a short string that identifies this look and feel, e.g. |
boolean |
getSupportsWindowDecorations
()
Returns true if the LookAndFeel returned RootPaneUI instances support providing Window decorations in a JRootPane. |
void |
initialize
()
UIManager.setLookAndFeel calls this method before the first call (and typically the only call) to getDefaults(). |
static void |
installBorder
(
JComponent
c,
String
defaultBorderName)
Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource. |
static void |
installColors
(
JComponent
c,
String
defaultBgName,
String
defaultFgName)
Convenience method for initializing a component's foreground and background color properties with values from the current defaults table. |
static void |
installColorsAndFont
(
JComponent
c,
String
defaultBgName,
String
defaultFgName,
String
defaultFontName)
Convenience method for initializing a components foreground background and font properties with values from the current defaults table. |
static void
|
installProperty
(
JComponent
c,
String
propertyName,
Object
Convenience method for installing a property with the specified name and value on a component if that property has not already been set by the client program.
|
abstract boolean |
isNativeLookAndFeel
()
If the underlying platform has a "native" look and feel, and this is an implementation of it, return true. |
abstract boolean |
isSupportedLookAndFeel
()
Return true if the underlying platform supports and or permits this look and feel. |
static void |
loadKeyBindings
(
InputMap
retMap,
Object
[] keys)
Loads the bindings in keys into retMap. |
static
ComponentInputMap
|
makeComponentInputMap
(
JComponent
c,
Object
[] keys)
Creates a ComponentInputMap from keys. |
static
Object
|
makeIcon
(
Class
baseClass,
String
gifFile)
Utility method that creates a UIDefaults.LazyValue that creates an ImageIcon UIResource for the specified gifFile filename. |
static
InputMap
|
makeInputMap
(
Object
[] keys)
Creates a InputMap from keys. |
static
JTextComponent.KeyBinding
[] |
makeKeyBindings
(
Object
[] keyBindingList)
Convenience method for building lists of KeyBindings. |
void |
provideErrorFeedback
(
Component
component)
Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus. |
String
|
toString
()
Returns a string that displays and identifies this object's properties. |
void |
uninitialize
()
UIManager.setLookAndFeel calls this method just before we're replaced by a new default look and feel. |
static void |
uninstallBorder
(
JComponent
c)
Convenience method for un-installing a component's default border on the specified component if the border is currently an instance of UIResource. |
LookAndFeel
public LookAndFeel()
installColors
public static void installColors(JComponent c,
String defaultBgName,
String defaultFgName)
-
Convenience method for initializing a component's foreground and background color properties with values from the current defaults table. The properties are only set if the current value is either null or a UIResource.
-
-
Parameters:
-
c - the target component for installing default color/font properties
-
defaultBgName - the key for the default background
-
defaultFgName - the key for the default foreground
-
See Also:
-
installColorsAndFont(javax.swing.JComponent, java.lang.String, java.lang.String, java.lang.String)
,
UIManager.getColor(java.lang.Object)
installColorsAndFont
public static void installColorsAndFont(JComponent c,
String defaultBgName,
String defaultFgName,
String defaultFontName)
-
Convenience method for initializing a components foreground background and font properties with values from the current defaults table. The properties are only set if the current value is either null or a UIResource.
-
-
Parameters:
-
c - the target component for installing default color/font properties
-
defaultBgName - the key for the default background
-
defaultFgName - the key for the default foreground
-
defaultFontName - the key for the default font
-
See Also:
-
installColors(javax.swing.JComponent, java.lang.String, java.lang.String)
,
UIManager.getColor(java.lang.Object)
,
UIManager.getFont(java.lang.Object)
installBorder
public static void installBorder(JComponent c,
String defaultBorderName)
-
Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource.
-
-
Parameters:
-
c - the target component for installing default border
-
defaultBorderName - the key specifying the default border
uninstallBorder
public static void uninstallBorder(JComponent c)
-
Convenience method for un-installing a component's default border on the specified component if the border is currently an instance of UIResource.
-
-
Parameters:
-
c - the target component for uninstalling default border
installProperty
public static void installProperty ( JComponent c,
String propertyName,
Object propertyValue)
-
Convenience method for installing a property with the specified name and value on a component if that property has not already been set by the client program. This method is intended to be used by UI delegate instances that need to specify a default value for a property of primitive type (boolean, int, ..), but do not wish to override a value set by the client. Since primitive property values cannot be wrapped with the UIResource marker, this method uses private state to determine whether the property has been set by the client.
-
-
Parameters:
-
c - the target component for installing the property
-
propertyName - String containing the name of the property to be set
-
propertyValue - Object containing the value of the property
-
Throws:
-
IllegalArgumentException
- if the specified property is not one which can be set using this method
-
ClassCastException
- may be thrown if the property value specified does not match the property's type
-
NullPointerException
- may be thrown if c or propertyValue is null
makeKeyBindings
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
-
Convenience method for building lists of KeyBindings.
Return an array of KeyBindings, one for each KeyStroke,Action pair in
keyBindingList
. A KeyStroke can either be a string in the format specified by the KeyStroke.getKeyStroke method or a KeyStroke object.
Actions are strings. Here's an example:
JTextComponent.KeyBinding[] multilineBindings = makeKeyBindings( new Object[] {
"UP", DefaultEditorKit.upAction,
"DOWN", DefaultEditorKit.downAction,
"PAGE_UP", DefaultEditorKit.pageUpAction,
"PAGE_DOWN", DefaultEditorKit.pageDownAction,
"ENTER", DefaultEditorKit.insertBreakAction,
"TAB", DefaultEditorKit.insertTabAction
});
-
-
Parameters:
-
keyBindingList - an array of KeyStroke,Action pairs
-
Returns:
-
an array of KeyBindings
makeInputMap
public static InputMap makeInputMap(Object[] keys)
-
Creates a InputMap from keys. keys describes the InputMap, with every even number item being a String giving the KeyStroke as speced in KeyStroke.getKeyStroke(String) (or a KeyStroke), and every odd number item the Object used to determine the associated Action in an ActionMap.
-
-
Since:
-
1.3
makeComponentInputMap
public static ComponentInputMap makeComponentInputMap(JComponent c,
Object[] keys)
-
Creates a ComponentInputMap from keys. keys describes the InputMap, with every even number item being a String giving the KeyStroke as speced in KeyStroke.getKeyStroke(String) (or a KeyStroke), and every odd number item the Object used to determine the associated Action in an ActionMap.
-
-
Since:
-
1.3
loadKeyBindings
public static void loadKeyBindings(InputMap retMap,
Object[] keys)
-
Loads the bindings in keys into retMap. This does not remove any existing bindings in retMap. keys describes the InputMap, with every even number item being a String giving the KeyStroke as speced in KeyStroke.getKeyStroke(String) (or a KeyStroke), and every odd number item the Object used to determine the associated Action in an ActionMap.
-
-
Since:
-
1.3
makeIcon
public static Object makeIcon(Class baseClass,
String gifFile)
-
Utility method that creates a UIDefaults.LazyValue that creates an ImageIcon UIResource for the specified gifFile filename.
-
provideErrorFeedback
public void provideErrorFeedback(Component component)
-
Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus. The default implementation beeps. Subclasses that wish different behavior should override this and provide the additional feedback.
-
-
Parameters:
-
component -
the
Component the error
occurred
occured
in, may be
null indicating
null indicating
the error condition is not directly associated with a
Component
-
Since:
-
1.4
Component.
getDesktopPropertyValue
public static Object getDesktopPropertyValue(String systemPropertyName,
Object fallbackValue)
-
Returns the value of the specified system desktop property by invoking Toolkit.getDefaultToolkit().getDesktopProperty(). If the current value of the specified property is null, the fallbackValue is returned.
-
-
Parameters:
-
systemPropertyName - the name of the system desktop property being queried
-
fallbackValue - the object to be returned as the value if the system value is null
-
Returns:
-
the current value of the desktop property
-
See Also:
-
Toolkit.getDesktopProperty(java.lang.String)
getName
public abstract String getName()
-
Return a short string that identifies this look and feel, e.g. "CDE/Motif". This string should be appropriate for a menu item. Distinct look and feels should have different names, e.g. a subclass of MotifLookAndFeel that changes the way a few components are rendered should be called "CDE/Motif My Way"; something that would be useful to a user trying to select a L&F from a list of names.
-
getID
public abstract String getID()
-
Return a string that identifies this look and feel. This string will be used by applications/services that want to recognize well known look and feel implementations. Presently the well known names are "Motif", "Windows", "Mac", "Metal". Note that a LookAndFeel derived from a well known superclass that doesn't make any fundamental changes to the look or feel shouldn't override this method.
-
getDescription
public abstract String getDescription()
-
Return a one line description of this look and feel implementation, e.g. "The CDE/Motif Look and Feel". This string is intended for the user, e.g. in the title of a window or in a ToolTip message.
-
getSupportsWindowDecorations
public boolean getSupportsWindowDecorations()
-
Returns true if the LookAndFeel returned RootPaneUI instances support providing Window decorations in a JRootPane.
The default implementation returns false, subclasses that support Window decorations should override this and return true.
-
-
Returns:
-
True if the RootPaneUI instances created support client side decorations
-
Since:
-
1.4
-
See Also:
-
JDialog.setDefaultLookAndFeelDecorated(boolean)
,
JFrame.setDefaultLookAndFeelDecorated(boolean)
,
JRootPane.setWindowDecorationStyle(int)
isNativeLookAndFeel
public abstract boolean isNativeLookAndFeel()
-
If the underlying platform has a "native" look and feel, and this is an implementation of it, return true. For example a CDE/Motif look and implementation would return true when the underlying platform was Solaris.
-
isSupportedLookAndFeel
public abstract boolean isSupportedLookAndFeel()
-
Return true if the underlying platform supports and or permits this look and feel. This method returns false if the look and feel depends on special resources or legal agreements that aren't defined for the current platform.
-
-
See Also:
-
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
initialize
public void initialize()
-
UIManager.setLookAndFeel calls this method before the first call (and typically the only call) to getDefaults(). Subclasses should do any one-time setup they need here, rather than in a static initializer, because look and feel class objects may be loaded just to discover that isSupportedLookAndFeel() returns false.
-
-
See Also:
-
uninitialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
uninitialize
public void uninitialize()
-
UIManager.setLookAndFeel calls this method just before we're replaced by a new default look and feel. Subclasses may choose to free up some resources here.
-
-
See Also:
-
initialize()
getDefaults
public UIDefaults getDefaults()
-
This method is called once by UIManager.setLookAndFeel to create the look and feel specific defaults table. Other applications, for example an application builder, may also call this method.
-
-
See Also:
-
initialize()
,
uninitialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
toString
public String toString()
-
Returns a string that displays and identifies this object's properties.
-
-
Overrides:
-
toString
in class
Object
-
-
Returns:
-
a String representation of this object