javax.swing.plaf.metal

Class MetalButtonUI

public class MetalButtonUI extends BasicButtonUI

A UI delegate for the {@link JButton} component.
Field Summary
protected ColordisabledTextColor
The color for disabled button labels.
protected ColorfocusColor
The color used to draw the focus rectangle around the text and/or icon.
protected ColorselectColor
The background color for the button when it is pressed.
Constructor Summary
MetalButtonUI()
Creates a new instance.
Method Summary
static ComponentUIcreateUI(JComponent c)
Returns a UI delegate for the specified component.
protected ColorgetDisabledTextColor()
Returns the color for the text label of disabled buttons.
protected ColorgetFocusColor()
Returns the color for the focus border.
protected ColorgetSelectColor()
Returns the color that indicates a selected button.
voidinstallDefaults(AbstractButton button)
Installs the default settings for the specified button.
protected voidpaintButtonPressed(Graphics g, AbstractButton b)
Paints the background of the button to indicate that it is in the "pressed" state.
protected voidpaintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)
Paints the focus rectangle around the button text and/or icon.
protected voidpaintText(Graphics g, JComponent c, Rectangle textRect, String text)
Paints the button text.
voiduninstallDefaults(AbstractButton button)
Removes the defaults added by {@link #installDefaults(AbstractButton)}.
voidupdate(Graphics g, JComponent c)
If the property Button.gradient is set, then a gradient is painted as background, otherwise the normal superclass behaviour is called.

Field Detail

disabledTextColor

protected Color disabledTextColor
The color for disabled button labels.

focusColor

protected Color focusColor
The color used to draw the focus rectangle around the text and/or icon.

selectColor

protected Color selectColor
The background color for the button when it is pressed.

Constructor Detail

MetalButtonUI

public MetalButtonUI()
Creates a new instance.

Method Detail

createUI

public static ComponentUI createUI(JComponent c)
Returns a UI delegate for the specified component.

Parameters: c the component (should be a subclass of {@link AbstractButton}).

Returns: A new instance of MetalButtonUI.

getDisabledTextColor

protected Color getDisabledTextColor()
Returns the color for the text label of disabled buttons.

Returns: the color for the text label of disabled buttons

getFocusColor

protected Color getFocusColor()
Returns the color for the focus border.

Returns: the color for the focus border

getSelectColor

protected Color getSelectColor()
Returns the color that indicates a selected button.

Returns: the color that indicates a selected button

installDefaults

public void installDefaults(AbstractButton button)
Installs the default settings for the specified button.

Parameters: button the button.

See Also: uninstallDefaults

paintButtonPressed

protected void paintButtonPressed(Graphics g, AbstractButton b)
Paints the background of the button to indicate that it is in the "pressed" state.

Parameters: g the graphics context. b the button.

paintFocus

protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)
Paints the focus rectangle around the button text and/or icon.

Parameters: g the graphics context. b the button. viewRect the button bounds. textRect the text bounds. iconRect the icon bounds.

paintText

protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text)
Paints the button text.

Parameters: g the graphics context. c the button. textRect the text bounds. text the text to display.

uninstallDefaults

public void uninstallDefaults(AbstractButton button)
Removes the defaults added by {@link #installDefaults(AbstractButton)}.

update

public void update(Graphics g, JComponent c)
If the property Button.gradient is set, then a gradient is painted as background, otherwise the normal superclass behaviour is called.