javax.swing.plaf.metal
public class MetalToggleButtonUI extends BasicToggleButtonUI
JToggleButton
component.Modifier and Type | Field and Description |
---|---|
protected Color |
disabledTextColor
The color for disabled button labels.
|
protected Color |
focusColor
The color for the focus border.
|
protected Color |
selectColor
The color that indicates a selected button.
|
defaultTextIconGap, defaultTextShiftOffset
Constructor and Description |
---|
MetalToggleButtonUI()
Constructs a new instance of
MetalToggleButtonUI . |
Modifier and Type | Method and Description |
---|---|
static ComponentUI |
createUI(JComponent component)
Returns a new instance of
MetalToggleButtonUI . |
protected Color |
getDisabledTextColor()
Returns the color for the text label of disabled buttons.
|
protected Color |
getFocusColor()
Returns the color for the focus border.
|
protected Color |
getSelectColor()
Returns the color that indicates a selected button.
|
void |
installDefaults(AbstractButton b)
Updates the button with the defaults for this look and feel.
|
protected void |
paintButtonPressed(Graphics g,
AbstractButton b)
Paints the button background when it is pressed/selected.
|
protected void |
paintFocus(Graphics g,
AbstractButton b,
Rectangle viewRect,
Rectangle textRect,
Rectangle iconRect)
Draws the focus highlight around the text and icon.
|
protected void |
paintText(Graphics g,
JComponent c,
Rectangle textRect,
String text)
Paints the text for the button.
|
void |
update(Graphics g,
JComponent c)
If the property
ToggleButton.gradient is set, then a gradient
is painted as background, otherwise the normal superclass behaviour is
called. |
getPropertyPrefix, paint, paintIcon
clearTextShiftOffset, createButtonListener, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, getTextShiftOffset, installKeyboardActions, installListeners, installUI, paintIcon, paintText, setTextShiftOffset, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
contains, getAccessibleChild, getAccessibleChildrenCount
protected Color focusColor
protected Color selectColor
protected Color disabledTextColor
public MetalToggleButtonUI()
MetalToggleButtonUI
.public static ComponentUI createUI(JComponent component)
MetalToggleButtonUI
.component
- the component for which we return an UI instanceMetalToggleButtonUI
.protected Color getFocusColor()
protected Color getSelectColor()
protected Color getDisabledTextColor()
installDefaults(AbstractButton)
method
by reading the ToggleButton.disabledText
item from the UI
defaults.public void installDefaults(AbstractButton b)
installDefaults
in class BasicButtonUI
b
- the button.protected void paintButtonPressed(Graphics g, AbstractButton b)
paintButtonPressed
in class BasicButtonUI
g
- the graphics device.b
- the button.protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text)
BasicButtonUI.paintText(java.awt.Graphics,
javax.swing.AbstractButton, java.awt.Rectangle, java.lang.String)
.paintText
in class BasicButtonUI
g
- the graphics device.c
- the component.textRect
- the bounds for the text.text
- the text.protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)
paintFocus
in class BasicButtonUI
g
- the graphics device.b
- the button.viewRect
- Visible rectangle, the area in which to painttextRect
- Text rectangle, contained in visible rectangleiconRect
- Icon rectangle, contained in visible rectangleAbstractButton.isFocusPainted()
,
Component.hasFocus()
public void update(Graphics g, JComponent c)
ToggleButton.gradient
is set, then a gradient
is painted as background, otherwise the normal superclass behaviour is
called.update
in class ComponentUI
g
- the graphics for painting.c
- the component for which this delegate performs
services.ComponentUI.paint(java.awt.Graphics, javax.swing.JComponent)
,
JComponent.paintComponent(java.awt.Graphics)