Class MetalToggleButtonUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ButtonUI
javax.swing.plaf.basic.BasicButtonUI
javax.swing.plaf.basic.BasicToggleButtonUI
javax.swing.plaf.metal.MetalToggleButtonUI
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 XMLEncoder.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColorThe color of a disabled text.protected ColorThe color of a focused toggle button.protected ColorThe color of a selected button.Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUIConstructs theMetalToggleButtonUI.protected ColorReturns the color of a disabled text.protected ColorReturns the color of a focused toggle button.protected ColorReturns the color of a selected button.voidInstalls default properties.protected voidPaints a pressed button.protected voidpaintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) Paints a focused button.protected voidpaintIcon(Graphics g, AbstractButton b, Rectangle iconRect) Paints the appropriate icon of the buttonbin the spaceiconRect.protected voidpaintText(Graphics g, JComponent c, Rectangle textRect, String text) Method which renders the text of the current button.protected voidUninstalls default properties.voidupdate(Graphics g, JComponent c) If necessary paints the background of the component, then invokespaint.Methods inherited from class javax.swing.plaf.basic.BasicToggleButtonUI
getPropertyPrefix, getTextShiftOffset, paintMethods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, createButtonListener, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, installKeyboardActions, installListeners, installUI, paintIcon, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallListeners, uninstallUIMethods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
Field Details
-
focusColor
The color of a focused toggle button. -
selectColor
The color of a selected button. -
disabledTextColor
The color of a disabled text.
-
-
Constructor Details
-
MetalToggleButtonUI
public MetalToggleButtonUI()Constructs aMetalToggleButtonUI.
-
-
Method Details
-
createUI
Constructs theMetalToggleButtonUI.- Parameters:
b- a component- Returns:
- the
MetalToggleButtonUI.
-
installDefaults
Description copied from class:BasicButtonUIInstalls default properties.- Overrides:
installDefaultsin classBasicButtonUI- Parameters:
b- an abstract button
-
uninstallDefaults
Description copied from class:BasicButtonUIUninstalls default properties.- Overrides:
uninstallDefaultsin classBasicButtonUI- Parameters:
b- an abstract button
-
getSelectColor
Returns the color of a selected button.- Returns:
- the color of a selected button
-
getDisabledTextColor
Returns the color of a disabled text.- Returns:
- the color of a disabled text
-
getFocusColor
Returns the color of a focused toggle button.- Returns:
- the color of a focused toggle button
-
update
If necessary paints the background of the component, then invokespaint.- Overrides:
updatein classComponentUI- Parameters:
g- Graphics to paint toc- JComponent painting on- Throws:
NullPointerException- ifgorcis null- Since:
- 1.5
- See Also:
-
paintButtonPressed
Description copied from class:BasicButtonUIPaints a pressed button.- Overrides:
paintButtonPressedin classBasicButtonUI- Parameters:
g- an instance ofGraphicsb- an abstract button
-
paintText
Description copied from class:BasicButtonUIMethod 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.- Overrides:
paintTextin classBasicButtonUI- Parameters:
g- an instance ofGraphicsc- a componenttextRect- a bounding rectangle to render the texttext- a string to render
-
paintFocus
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) Description copied from class:BasicButtonUIPaints a focused button.- Overrides:
paintFocusin classBasicButtonUI- Parameters:
g- an instance ofGraphicsb- an abstract buttonviewRect- a bounding rectangle to render the buttontextRect- a bounding rectangle to render the texticonRect- a bounding rectangle to render the icon
-
paintIcon
Paints the appropriate icon of the buttonbin the spaceiconRect.- Overrides:
paintIconin classBasicToggleButtonUI- Parameters:
g- Graphics to paint tob- Button to render foriconRect- space to render in- Throws:
NullPointerException- if any of the arguments are null.- Since:
- 1.5
-