APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.plaf.metal

public Class MetalToggleButtonUI

extends BasicToggleButtonUI
Class Inheritance
Imports
sun.swing.SwingUtilities2, java.awt.*, java.awt.event.*, java.lang.ref.*, java.util.*, javax.swing.plaf.basic.BasicToggleButtonUI, javax.swing.*, javax.swing.*, javax.swing.border.*, javax.swing.plaf.*, java.io.Serializable

MetalToggleButton 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
private boolean
protected Color
disabledTextColor

The color of a disabled text.

protected Color
focusColor

The color of a focused toggle button.

protected Color
selectColor

The color of a selected button.

private static final ComponentUI

Constructor Summary

AccessConstructor and Description
public
MetalToggleButtonUI()

Constructs a MetalToggleButtonUI.

Method Summary

Modifier and TypeMethod and Description
public static ComponentUI

Returns:

the MetalToggleButtonUI.
createUI
(JComponent
a component
b
)

Hides javax.swing.plaf.basic.BasicToggleButtonUI.createUI.

Constructs the MetalToggleButtonUI.

protected Color

Returns:

the color of a disabled text
getDisabledTextColor
()

Returns the color of a disabled text.

protected Color

Returns:

the color of a focused toggle button
getFocusColor
()

Returns the color of a focused toggle button.

protected Color

Returns:

the color of a selected button
getSelectColor
()

Returns the color of a selected button.

public void
protected void
protected void
paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)

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

Paints a focused button.

protected void
paintIcon(Graphics
Graphics to paint to
g
,
AbstractButton
Button to render for
b
,
Rectangle
space to render in
iconRect
)

Overrides javax.swing.plaf.basic.BasicToggleButtonUI.paintIcon.

Paints the appropriate icon of the button b in the space iconRect.

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

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

Method which renders the text of the current button.

protected void
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.BasicToggleButtonUI:
getPropertyPrefixgetTextShiftOffsetpaint

Field Detail

defaults_initializedback to summary
private boolean defaults_initialized
disabledTextColorback to summary
protected Color disabledTextColor

The color of a disabled text.

focusColorback to summary
protected Color focusColor

The color of a focused toggle button.

selectColorback to summary
protected Color selectColor

The color of a selected button.

UIback to summary
private static final ComponentUI UI

Hides javax.swing.plaf.basic.BasicToggleButtonUI.UI.

Constructor Detail

MetalToggleButtonUIback to summary
public MetalToggleButtonUI()

Constructs a MetalToggleButtonUI.

Method Detail

createUIback to summary
public static ComponentUI createUI(JComponent b)

Hides javax.swing.plaf.basic.BasicToggleButtonUI.createUI.

Constructs the MetalToggleButtonUI.

Parameters
b:JComponent

a component

Returns:ComponentUI

the MetalToggleButtonUI.

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 a focused toggle button.

Returns:Color

the color of a focused toggle button

getSelectColorback to summary
protected Color getSelectColor()

Returns the color of a selected button.

Returns:Color

the color of a 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.

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.

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.

paintIconback to summary
protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect)

Overrides javax.swing.plaf.basic.BasicToggleButtonUI.paintIcon.

Paints the appropriate icon of the button b in the space iconRect.

Parameters
g:Graphics

Graphics to paint to

b:AbstractButton

Button to render for

iconRect:Rectangle

space to render in

Exceptions
NullPointerException:
if any of the arguments are null.
Since
1.5
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.

uninstallDefaultsback to summary
protected void uninstallDefaults(AbstractButton b)

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

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

Uninstalls default properties.

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