class org.aswing.JLabel extends Component
Sub classes | ||||||||||
DateLabel, DefaultGridCell, DefaultTextCell, DefaultTreeCell |
|
A display area for a short text string or an image, or both.
A label does not react to input events. As a result, it cannot get the keyboard focus. A label can, however, display a keyboard alternative as a convenience for a nearby component that has a keyboard alternative but can't display it.
A JLabel
object can display
either text, an image, or both.
You can specify where in the label's display area
the label's contents are aligned
by setting the vertical and horizontal alignment.
By default, labels are vertically centered
in their display area.
Text-only labels are leading edge aligned, by default;
image-only labels are horizontally centered, by default.
You can also specify the position of the text relative to the image. By default, text is on the trailing edge of the image, with the text and image vertically aligned.
Finally, you can use the this.setIconTextGap
method
to specify how many pixels
should appear between the text and the image.
The default is 4 pixels.
@author paling
Class Fields
Instance Fields
var disabledIcon:Icon
The icon used by the label when it's disabled.
If no disabled icon has been set, the button constructs one from the default icon if defalut icon setted otherwise returns null.
The disabled icon really should be created (if necessary) by the L&F
@see #enabled
The horizontal alignment of the icon and text.
One of the following values:
AsWingConstants.RIGHT
(the default)AsWingConstants.LEFT
AsWingConstants.CENTER
var horizontalTextPosition:Int
The horizontal position of the text relative to the icon.
AsWingConstants.RIGHT
(the default)AsWingConstants.LEFT
AsWingConstants.CENTER
var iconTextGap:Int
If both the icon and text properties are set, this property defines the space between them.
The default value of this property is 4 pixels.
The vertical position of the text relative to the icon.
One of the following values:
AsWingConstants.CENTER
(the default)AsWingConstants.TOP
AsWingConstants.BOTTOM
function new(?text:String = '', ?icon:Icon = null, ?horizontalAlignment:Int = 0): Void
Creates a label.
text | the text |
icon | the icon |
horizontalAlignment | the horizontal alignment, default is |
function getIconTextGap(): Float
Returns the amount of space between the text and the icon displayed in this button.
@see #setIconTextGap()
returns | an int equal to the number of pixels between the text and the icon. |
function setIconTextGap(iconTextGap:Float): Void
If both the icon and text properties are set, this property defines the space between them.
The default value of this property is 4 pixels.
@see #getIconTextGap()