BasicToggleButtonUI
, MetalButtonUI
, SynthButtonUI
public class BasicButtonUI extends ButtonUI
Modifier and Type | Field | Description |
---|---|---|
protected int |
defaultTextIconGap |
The default gap between a text and an icon. |
protected int |
defaultTextShiftOffset |
The default offset of a text. |
Constructor | Description |
---|---|
BasicButtonUI() |
Constructs a BasicButtonUI . |
Modifier and Type | Method | Description |
---|---|---|
protected void |
clearTextShiftOffset() |
Clears the offset of the text. |
protected BasicButtonListener |
createButtonListener |
Returns a new instance of BasicButtonListener . |
static ComponentUI |
createUI |
Returns an instance of BasicButtonUI . |
int |
getBaseline |
Returns the baseline. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior |
Returns an enum indicating how the baseline of the component changes as the size changes. |
int |
getDefaultTextIconGap |
Returns the default gap between a text and an icon. |
protected String |
getPropertyPrefix() |
Returns the property prefix. |
protected int |
getTextShiftOffset() |
Returns the offset of the text. |
protected void |
installDefaults |
Installs default properties. |
protected void |
installKeyboardActions |
Registers keyboard actions. |
protected void |
installListeners |
Registers listeners. |
protected void |
paintButtonPressed |
Paints a pressed button. |
protected void |
paintFocus |
Paints a focused button. |
protected void |
paintIcon |
Paints an icon of the current button. |
protected void |
paintText |
Method which renders the text of the current button. |
protected void |
paintText |
Method which renders the text of the current button. |
protected void |
setTextShiftOffset() |
Sets the offset of the text. |
protected void |
uninstallDefaults |
Uninstalls default properties. |
protected void |
uninstallKeyboardActions |
Unregisters keyboard actions. |
protected void |
uninstallListeners |
Unregisters listeners. |
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
protected int defaultTextIconGap
protected int defaultTextShiftOffset
public BasicButtonUI()
BasicButtonUI
.public static ComponentUI createUI(JComponent c)
BasicButtonUI
.c
- a componentBasicButtonUI
protected String getPropertyPrefix()
protected void installDefaults(AbstractButton b)
b
- an abstract buttonprotected void installListeners(AbstractButton b)
b
- an abstract buttonprotected void installKeyboardActions(AbstractButton b)
b
- an abstract buttonprotected void uninstallKeyboardActions(AbstractButton b)
b
- an abstract buttonprotected void uninstallListeners(AbstractButton b)
b
- an abstract buttonprotected void uninstallDefaults(AbstractButton b)
b
- an abstract buttonprotected BasicButtonListener createButtonListener(AbstractButton b)
BasicButtonListener
.b
- an abstract buttonBasicButtonListener
public int getDefaultTextIconGap(AbstractButton b)
b
- an abstract buttonprotected void paintIcon(Graphics g, JComponent c, Rectangle iconRect)
g
- an instance of Graphics
c
- a componenticonRect
- a bounding rectangle to render the iconprotected void paintText(Graphics g, JComponent c, Rectangle textRect, String text)
g
- an instance of Graphics
c
- a componenttextRect
- a bounding rectangle to render the texttext
- a string to renderprotected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
g
- Graphics contextb
- Current button to rendertextRect
- Bounding rectangle to render the texttext
- String to renderprotected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)
g
- an instance of Graphics
b
- an abstract buttonviewRect
- a bounding rectangle to render the buttontextRect
- a bounding rectangle to render the texticonRect
- a bounding rectangle to render the iconprotected void paintButtonPressed(Graphics g, AbstractButton b)
g
- an instance of Graphics
b
- an abstract buttonprotected void clearTextShiftOffset()
protected void setTextShiftOffset()
protected int getTextShiftOffset()
public int getBaseline(JComponent c, int width, int height)
getBaseline
in class ComponentUI
c
- JComponent
baseline is being requested forwidth
- the width to get the baseline forheight
- the height to get the baseline forNullPointerException
- if c
is null
IllegalArgumentException
- if width or height is < 0public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
in class ComponentUI
c
- JComponent
to return baseline resize behavior forNullPointerException
- if c
is null
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/plaf/basic/BasicButtonUI.html