Top Description Fields Constructors Methods
javax.swing.plaf.metal

public Class MetalButtonUI

extends BasicButtonUI
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
sun.swing.SwingUtilities2, sun.awt.AppContext, javax.swing.*, javax.swing.border.*, javax.swing.plaf.basic.*, java.awt.*, java.awt.event.*, java.beans.*, javax.swing.plaf.*

MetalButtonUI implementation

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 JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
Tom Santos

Field Summary

Modifier and TypeField and Description
protected Color
disabledTextColor

The color of the disabled color.

protected Color
focusColor

The color of the focused button.

private static final Object
protected Color
selectColor

The color of the selected button.

Inherited from javax.swing.plaf.basic.BasicButtonUI:
defaultTextIconGapdefaultTextShiftOffset

Constructor Summary

AccessConstructor and Description
public
MetalButtonUI()

Constructs a MetalButtonUI.

Method Summary

Modifier and TypeMethod and Description
protected BasicButtonListener
createButtonListener(AbstractButton
an abstract button
b
)

Overrides javax.swing.plaf.basic.BasicButtonUI.createButtonListener.

Returns a new instance of BasicButtonListener.

public static ComponentUI

Returns:

an instance of MetalButtonUI
createUI
(JComponent
a component
c
)

Hides javax.swing.plaf.basic.BasicButtonUI.createUI.

Returns an instance of MetalButtonUI.

protected Color

Returns:

the color of a disabled text
getDisabledTextColor
()

Returns the color of a disabled text.

protected Color

Returns:

the color of the focused button
getFocusColor
()

Returns the color of the focused button.

protected Color

Returns:

the color of the selected button
getSelectColor
()

Returns the color of the selected button.

public void
installDefaults(AbstractButton
an abstract button
b
)

Overrides javax.swing.plaf.basic.BasicButtonUI.installDefaults.

Installs default properties.

protected void
paintButtonPressed(Graphics
an instance of Graphics
g
,
AbstractButton
an abstract button
b
)

Overrides javax.swing.plaf.basic.BasicButtonUI.paintButtonPressed.

Paints a pressed button.

protected void
paintFocus(Graphics
an instance of Graphics
g
,
AbstractButton
an abstract button
b
,
Rectangle
a bounding rectangle to render the button
viewRect
,
Rectangle
a bounding rectangle to render the text
textRect
,
Rectangle
a bounding rectangle to render the icon
iconRect
)

Overrides javax.swing.plaf.basic.BasicButtonUI.paintFocus.

Paints a focused button.

protected void
paintText(Graphics
an instance of Graphics
g
,
JComponent
a component
c
,
Rectangle
a bounding rectangle to render the text
textRect
,
String
a string to render
text
)

Overrides javax.swing.plaf.basic.BasicButtonUI.paintText.

Method which renders the text of the current button.

public void
uninstallDefaults(AbstractButton
an abstract button
b
)

Overrides javax.swing.plaf.basic.BasicButtonUI.uninstallDefaults.

Uninstalls default properties.

public void
update(Graphics
Graphics to paint to
g
,
JComponent
JComponent painting on
c
)

Overrides javax.swing.plaf.ComponentUI.update.

If necessary paints the background of the component, then invokes paint.

Inherited from javax.swing.plaf.basic.BasicButtonUI:
clearTextShiftOffsetgetBaselinegetBaselineResizeBehaviorgetDefaultTextIconGapgetMaximumSizegetMinimumSizegetPreferredSizegetPropertyPrefixgetTextShiftOffsetinstallKeyboardActionsinstallListenersinstallUIpaintpaintIconpaintTextsetTextShiftOffsetuninstallKeyboardActionsuninstallListenersuninstallUI

Field Detail

disabledTextColorback to summary
protected Color disabledTextColor

The color of the disabled color.

focusColorback to summary
protected Color focusColor

The color of the focused button.

METAL_BUTTON_UI_KEYback to summary
private static final Object METAL_BUTTON_UI_KEY
selectColorback to summary
protected Color selectColor

The color of the selected button.

Constructor Detail

MetalButtonUIback to summary
public MetalButtonUI()

Constructs a MetalButtonUI.

Method Detail

createButtonListenerback to summary
protected BasicButtonListener createButtonListener(AbstractButton b)

Overrides javax.swing.plaf.basic.BasicButtonUI.createButtonListener.

Doc from javax.swing.plaf.basic.BasicButtonUI.createButtonListener.

Returns a new instance of BasicButtonListener.

Parameters
b:AbstractButton

an abstract button

Returns:BasicButtonListener

a new instance of BasicButtonListener

createUIback to summary
public static ComponentUI createUI(JComponent c)

Hides javax.swing.plaf.basic.BasicButtonUI.createUI.

Returns an instance of MetalButtonUI.

Parameters
c:JComponent

a component

Returns:ComponentUI

an instance of MetalButtonUI

getDisabledTextColorback to summary
protected Color getDisabledTextColor()

Returns the color of a disabled text.

Returns:Color

the color of a disabled text

getFocusColorback to summary
protected Color getFocusColor()

Returns the color of the focused button.

Returns:Color

the color of the focused button

getSelectColorback to summary
protected Color getSelectColor()

Returns the color of the selected button.

Returns:Color

the color of the selected button

installDefaultsback to summary
public void installDefaults(AbstractButton b)

Overrides javax.swing.plaf.basic.BasicButtonUI.installDefaults.

Doc from javax.swing.plaf.basic.BasicButtonUI.installDefaults.

Installs default properties.

Parameters
b:AbstractButton

an abstract button

paintButtonPressedback to summary
protected void paintButtonPressed(Graphics g, AbstractButton b)

Overrides javax.swing.plaf.basic.BasicButtonUI.paintButtonPressed.

Doc from javax.swing.plaf.basic.BasicButtonUI.paintButtonPressed.

Paints a pressed button.

Parameters
g:Graphics

an instance of Graphics

b:AbstractButton

an abstract button

paintFocusback to summary
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)

Overrides javax.swing.plaf.basic.BasicButtonUI.paintFocus.

Doc from javax.swing.plaf.basic.BasicButtonUI.paintFocus.

Paints a focused button.

Parameters
g:Graphics

an instance of Graphics

b:AbstractButton

an abstract button

viewRect:Rectangle

a bounding rectangle to render the button

textRect:Rectangle

a bounding rectangle to render the text

iconRect:Rectangle

a bounding rectangle to render the icon

paintTextback to summary
protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text)

Overrides javax.swing.plaf.basic.BasicButtonUI.paintText.

Doc from javax.swing.plaf.basic.BasicButtonUI.paintText.

Method which renders the text of the current button. As of Java 2 platform v 1.4 this method should not be used or overridden. Use the paintText method which takes the AbstractButton argument.

Parameters
g:Graphics

an instance of Graphics

c:JComponent

a component

textRect:Rectangle

a bounding rectangle to render the text

text:String

a string to render

uninstallDefaultsback to summary
public void uninstallDefaults(AbstractButton b)

Overrides javax.swing.plaf.basic.BasicButtonUI.uninstallDefaults.

Doc from javax.swing.plaf.basic.BasicButtonUI.uninstallDefaults.

Uninstalls default properties.

Parameters
b:AbstractButton

an abstract button

updateback to summary
public void update(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.update.

If necessary paints the background of the component, then invokes paint.

Parameters
g:Graphics

Graphics to paint to

c:JComponent

JComponent painting on

Exceptions
NullPointerException:
if g or c is null
Since
1.5
See Also
javax.swing.plaf.ComponentUI#update, javax.swing.plaf.ComponentUI#paint