buoy.widget
Class BButton
A BButton is a pushbutton Widget. Its appearance can be customized by setting the text and/or image which
appears on it.
In addition to the event types generated by all Widgets, BButtons generate the following event types:
static class | BButton.Position - This inner class represents a value for the alignment or text position.
|
BButton() - Create a new BButton with no set text or image.
|
BButton(Icon icon) - Create a new BButton.
|
BButton(String text) - Create a new BButton.
|
BButton(String text, Icon icon) - Create a new BButton.
|
String | getActionCommand() - Get the "action command" which will be sent in a CommandEvent when this button is pressed.
|
JButton | getComponent()
|
Icon | getIcon() - Get the image being displayed on the button.
|
Dimension | getMaximumSize() - Get the largest size at which this Widget can reasonably be drawn.
|
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(String command) - Set the "action command" which will be sent in a CommandEvent when this button is pressed.
|
void | setIcon(Icon icon) - Set the image being displayed on the button.
|
void | setText(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 , getComponent , getCursor , getFont , getMaximumSize , getMinimumSize , getName , getParent , getPreferredSize , hasFocus , isEnabled , isFocusable , isVisible , repaint , requestFocus , setBackground , setCursor , setEnabled , setFocusable , setFont , setName , setVisible |
BButton
public BButton()
Create a new BButton with no set text or image.
BButton
public BButton(Icon icon)
Create a new BButton.
icon
- the image to display on the button
BButton
public BButton(String text)
Create a new BButton.
text
- the text to display on the button
BButton
public BButton(String text,
Icon icon)
Create a new BButton.
text
- the text to display on the buttonicon
- the image to display on the button
getActionCommand
public String getActionCommand()
Get the "action command" which will be sent in a CommandEvent when this button is pressed.
getIcon
public Icon getIcon()
Get the image being displayed on the button. This may be null.
getMaximumSize
public Dimension getMaximumSize()
Get the largest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out
its contents, it will attempt never to make this Widget larger than its maximum size.
- getMaximumSize in interface Widget
getText
public String getText()
Get the text being displayed on the button. This may be null.
getTextPosition
public BButton.Position getTextPosition()
Get the position of the text relative to the image. This will be one of the alignment constants
defined by this class: CENTER, NORTH, NORTHEAST, EAST, etc.
setActionCommand
public void setActionCommand(String command)
Set the "action command" which will be sent in a CommandEvent when this button is pressed.
setIcon
public void setIcon(Icon icon)
Set the image being displayed on the button. This may be null.
setText
public void setText(String text)
Set the text being displayed on the button. This may be null.
setTextPosition
public void setTextPosition(BButton.Position position)
Set the position of the text relative to the image. This should be one of the alignment constants
defined by this class: CENTER, NORTH, NORTHEAST, EAST, etc. If this BButton does not display both
text and an image, this method will have no effect.
Written by Peter Eastman.