is new.
java.lang.Objectjavax.swing.LookAndFeel
public abstract class LookAndFeel
Completely characterizes a look and feel from the point of view of the pluggable look and feel components.
| Constructor Summary | |
|---|---|
|
LookAndFeel
() |
|
| 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(). |
Icon
|
getDisabledIcon
(
JComponent
component,
Icon
Returns an Icon with a disabled appearance.
|
Icon
|
getDisabledSelectedIcon
(
JComponent
component,
Icon
Returns an Icon for use by disabled components that are also selected.
|
| 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
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. |
| 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,
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. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Constructor Detail |
|---|
public LookAndFeel()
| Method Detail |
|---|
public static void installColors(JComponent c,
String defaultBgName,
String defaultFgName)
public static void installColorsAndFont(JComponent c,
String defaultBgName,
String defaultFgName,
String defaultFontName)
public static void installBorder(JComponent c,
String defaultBorderName)
public static void uninstallBorder(JComponent c)
public static void installProperty(JComponent c,
String propertyName,
Object propertyValue)
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
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
});
public static InputMap makeInputMap(Object[] keys)
public static ComponentInputMap makeComponentInputMap(JComponent c,
Object[] keys)
public static void loadKeyBindings(InputMap retMap,
Object[] keys)
public static ObjectmakeIcon(Class<?> baseClass,
baseClass,String gifFile)
public void provideErrorFeedback(Component component)
public static Object getDesktopPropertyValue(String systemPropertyName,
Object fallbackValue)
getDisabledIcon
public
Icon
getDisabledIcon
(
JComponent
component,
Icon
icon)
Returns an Icon with a disabled appearance. This method is used to generate a disabled Icon when one has not been specified. For example, if you create a JButton and only specify an Icon via setIcon this method will be called to generate the disabled Icon. If null is passed as icon this method returns null.
Some look and feels might not render the disabled Icon, in which case they will ignore this.
Parameters:
component - JComponent that will display the Icon, may be null
icon - Icon to generate disable icon from.
Returns:
Disabled icon, or null if a suitable Icon can not be generated.
Since:
1.5
getDisabledSelectedIcon
public
Icon
getDisabledSelectedIcon
(
JComponent
component,
Icon
icon)
Returns an Icon for use by disabled components that are also selected. This method is used to generate an Icon for components that are in both the disabled and selected states but do not have a specific Icon for this state. For example, if you create a JButton and only specify an Icon via setIcon this method will be called to generate the disabled and selected Icon. If null is passed as icon this method returns null.
Some look and feels might not render the disabled and selected Icon, in which case they will ignore this.
Parameters:
component - JComponent that will display the Icon, may be null
icon - Icon to generate disabled and selected icon from.
Returns:
Disabled and Selected icon, or null if a suitable Icon can not be generated.
Since:
1.5
public abstract String getName()
public abstract String getID()
public abstract String getDescription()
public boolean getSupportsWindowDecorations()
The default implementation returns false, subclasses that support Window decorations should override this and return true.
public abstract boolean isNativeLookAndFeel()
public abstract boolean isSupportedLookAndFeel()
public void initialize()
public void uninitialize()
public UIDefaults getDefaults()
public String toString()