public class BButton extends Widget
In addition to the event types generated by all Widgets, BButtons generate the following event types:
Modifier and Type | Class and Description |
---|---|
static class |
BButton.Position
This inner class represents a value for the alignment or text position.
|
Modifier and Type | Field and Description |
---|---|
static BButton.Position |
CENTER |
static BButton.Position |
EAST |
static BButton.Position |
NORTH |
static BButton.Position |
NORTHEAST |
static BButton.Position |
NORTHWEST |
static BButton.Position |
SOUTH |
static BButton.Position |
SOUTHEAST |
static BButton.Position |
SOUTHWEST |
static BButton.Position |
WEST |
Constructor and Description |
---|
BButton()
Create a new BButton with no set text or image.
|
BButton(javax.swing.Icon icon)
Create a new BButton.
|
BButton(java.lang.String text)
Create a new BButton.
|
BButton(java.lang.String text,
javax.swing.Icon icon)
Create a new BButton.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getActionCommand()
Get the "action command" which will be sent in a CommandEvent when this button is pressed.
|
javax.swing.JButton |
getComponent()
Get the java.awt.Component corresponding to this Widget.
|
javax.swing.Icon |
getIcon()
Get the image being displayed on the button.
|
java.awt.Dimension |
getMaximumSize()
Get the largest size at which this Widget can reasonably be drawn.
|
java.lang.String |
getText()
Get the text being displayed on the button.
|
BButton.Position |
getTextPosition()
Get the position of the text relative to the image.
|
void |
setActionCommand(java.lang.String command)
Set the "action command" which will be sent in a CommandEvent when this button is pressed.
|
void |
setIcon(javax.swing.Icon icon)
Set the image being displayed on the button.
|
void |
setText(java.lang.String text)
Set the text being displayed on the button.
|
void |
setTextPosition(BButton.Position position)
Set the position of the text relative to the image.
|
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
addEventLink, addEventLink, removeEventLink
public static final BButton.Position CENTER
public static final BButton.Position NORTH
public static final BButton.Position SOUTH
public static final BButton.Position WEST
public static final BButton.Position EAST
public static final BButton.Position NORTHEAST
public static final BButton.Position SOUTHEAST
public static final BButton.Position NORTHWEST
public static final BButton.Position SOUTHWEST
public BButton()
public BButton(java.lang.String text)
text
- the text to display on the buttonpublic BButton(javax.swing.Icon icon)
icon
- the image to display on the buttonpublic BButton(java.lang.String text, javax.swing.Icon icon)
text
- the text to display on the buttonicon
- the image to display on the buttonpublic javax.swing.JButton getComponent()
Widget
getComponent
in class Widget
public java.lang.String getText()
public void setText(java.lang.String text)
public javax.swing.Icon getIcon()
public void setIcon(javax.swing.Icon icon)
public java.lang.String getActionCommand()
public void setActionCommand(java.lang.String command)
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class Widget
public BButton.Position getTextPosition()
public void setTextPosition(BButton.Position position)
Written by Peter Eastman.