JLabel

Extends
JComponent
Methods
17
Fields
8

Getting one

JLabel.new(…)

Methods

MethodReturnsDescription
getIcon()Icon?The icon: an ImageIcon or the plugin's own Icon table, or nil.
setIcon(any)()Shows icon (an ImageIcon, or a table with getIconWidth, getIconHeight and paintIcon) beside the text; nil removes it.
getText()string?The text, or nil.
setText(string?)()Sets the text (plain, or <html>...); a changed text lays the label out again and repaints it.
getHorizontalAlignment()numberThe horizontal alignment.
setHorizontalAlignment(number)()Aligns the label's contents horizontally (JLabel.LEFT, CENTER, RIGHT, LEADING, TRAILING).
getVerticalAlignment()numberThe vertical alignment.
setVerticalAlignment(number)()Aligns the label's contents vertically (JLabel.TOP, CENTER, BOTTOM).
setHorizontalTextPosition(number)()Where the text sits beside the icon, horizontally.
setVerticalTextPosition(number)()Where the text sits beside the icon, vertically.
getIconTextGap()numberThe gap between the icon and the text.
setIconTextGap(number)()Sets the gap between the icon and the text.
getLabelFor()Component?The component this label labels, or nil.
setLabelFor(Component?)()Names the component this label labels.
new(string?, number)JLabel() -> JLabel: An empty label.
new(any)JLabel
new(string?, any, number)JLabel
init(JLabel, string?, number)()(JLabel) -> (): An empty label.
init(JLabel, any)()
init(JLabel, string?, any, number)()
isInstance(any)booleanWhether obj is a JLabel object, a class(JLabel) subclass's included.

Fields

FieldTypeDescription
CENTERnumberSwingConstants.CENTER: 0.
TOPnumberSwingConstants.TOP: 1.
LEFTnumberSwingConstants.LEFT: 2.
BOTTOMnumberSwingConstants.BOTTOM: 3.
LEADINGnumberSwingConstants.LEADING: 10.
TRAILINGnumberSwingConstants.TRAILING: 11.
superJComponentClassJComponent's class table: the base class.

Returned by

MethodReturnsDescription
JLabelClass.newJLabel() -> JLabel: An empty label.

Method details

getIcon

getIcon: (JLabel) -> Icon?

The icon: an ImageIcon or the plugin's own Icon table, or nil.

setIcon

setIcon: (JLabel, any) -> ()

Shows icon (an ImageIcon, or a table with getIconWidth, getIconHeight and paintIcon) beside the text; nil removes it.

setText

setText: (JLabel, string?) -> ()

Sets the text (plain, or <html>...); a changed text lays the label out again and repaints it.

setHorizontalAlignment

setHorizontalAlignment: (JLabel, number) -> ()

Aligns the label's contents horizontally (JLabel.LEFT, CENTER, RIGHT, LEADING, TRAILING).

setVerticalAlignment

setVerticalAlignment: (JLabel, number) -> ()

Aligns the label's contents vertically (JLabel.TOP, CENTER, BOTTOM).

new

new: ((string?, number) -> JLabel) & ((any) -> JLabel) & ((string?, any, number) -> JLabel)

() -> JLabel: An empty label.

(string?) -> JLabel: A label showing text, leading-aligned.

(string?, number) -> JLabel: A label showing text, aligned by horizontalAlignment (JLabel.LEFT, CENTER, RIGHT, LEADING, TRAILING).

(any) -> JLabel: A label showing image, centred.

(string?, any, number) -> JLabel: A label showing text and icon, aligned by horizontalAlignment.

init

init: ((JLabel, string?, number) -> ()) & ((JLabel, any) -> ()) & ((JLabel, string?, any, number) -> ())

(JLabel) -> (): An empty label.

(JLabel, string?) -> (): A label showing text, leading-aligned.

(JLabel, string?, number) -> (): A label showing text, aligned by horizontalAlignment (JLabel.LEFT, CENTER, RIGHT, LEADING, TRAILING).

(JLabel, any) -> (): A label showing image, centred.

(JLabel, string?, any, number) -> (): A label showing text and icon, aligned by horizontalAlignment.

isInstance

isInstance: (any) -> boolean

Whether obj is a JLabel object, a class(JLabel) subclass's included.