buoy.widget
Class BLabel
A BLabel is a Widget that displays a text string, an image, or both. The text may be specified as
HTML, allowing it to contain complex formatting, multiple fonts, etc.
static class | BLabel.Position - This inner class represents a value for the alignment or text position.
|
BLabel() - Create a new BLabel with no text or image.
|
BLabel(Icon image) - Create a new BLabel which displays an image.
|
BLabel(Icon image, BLabel.Position align) - Create a new BLabel which displays an image.
|
BLabel(String text) - Create a new BLabel which displays text.
|
BLabel(String text, Icon image, BLabel.Position align, BLabel.Position textPos) - Create a new BLabel which displays both text and an image.
|
BLabel(String text, BLabel.Position align) - Create a new BLabel which displays text.
|
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 |
BLabel
public BLabel()
Create a new BLabel with no text or image.
BLabel
public BLabel(Icon image)
Create a new BLabel which displays an image.
image
- the image to display on the BLabel
BLabel
public BLabel(Icon image,
BLabel.Position align)
Create a new BLabel which displays an image.
image
- the image to display on the BLabelalign
- the alignment of the label contents (CENTER, NORTH, NORTHEAST, etc.)
BLabel
public BLabel(String text)
Create a new BLabel which displays text.
text
- the text to display on the BLabel
BLabel
public BLabel(String text,
Icon image,
BLabel.Position align,
BLabel.Position textPos)
Create a new BLabel which displays both text and an image.
text
- the text to display on the BLabelimage
- the image to display on the BLabelalign
- the alignment of the label contents (CENTER, NORTH, NORTHEAST, etc.)textPos
- the position of the text relative to the image (CENTER, NORTH, NORTHEAST, etc.)
BLabel
public BLabel(String text,
BLabel.Position align)
Create a new BLabel which displays text.
text
- the text to display on the BLabelalign
- the alignment of the label contents (CENTER, NORTH, NORTHEAST, etc.)
getAlignment
public BLabel.Position getAlignment()
Get the alignment of the label's contents. This will be one of the alignment constants
defined by this class: CENTER, NORTH, NORTHEAST, EAST, etc.
getIcon
public Icon getIcon()
Get the image which appears on this label.
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 which appears on this label.
getTextPosition
public BLabel.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.
setAlignment
public void setAlignment(BLabel.Position alignment)
Set the alignment of the label's contents. This should be one of the alignment constants
defined by this class: CENTER, NORTH, NORTHEAST, EAST, etc.
setIcon
public void setIcon(Icon image)
Set the image which appears on this label.
setText
public void setText(String text)
Set the text which appears on this label.
setTextPosition
public void setTextPosition(BLabel.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 BLabel does not display both
text and an image, this method will have no effect.
Written by Peter Eastman.