BiLabel

This class is used to show text

This class extends BiComponent and therefore all methods and fields available for BiComponent are also available for BiLabel .

Constructor

new BiLabel ( [ sText ] )

Parameters

NameTypeOptionalDefaultDescripton
sTextStringchecked"" The text to show on the label

Properties

NameTypegetsetDescripton
alignStringcheckedcheckedThe text alignment. Valid values are:

left
right
center
justify
fontBiFontcheckedcheckedThis is used to describe how to paint the text on the label.
htmlStringcheckedcheckedThe HTML text shown on the label
iconBiImagecheckedcheckedThe icon image to show on the label. Note that changing the image object does not update the label icon. You'll have to set the icon property to update the label icon.
iconPositionStringcheckedcheckedThe position of the icon relative to the text. Valid values are:

left
right
top
bottom
iconTextGapNumbercheckedcheckedThe gap between the icon and the text (in pixels)
labelForBiComponentcheckedcheckedIf this is set then focusing on the current label moves the focus to another component
mnemonicStringcheckedcheckedA character used to give UI hints about the access key for the label
paddingBottomNumbercheckedcheckedThe bottom padding (in pixels)
paddingLeftNumbercheckedcheckedThe left padding (in pixels)
paddingRightNumbercheckedcheckedThe right padding (in pixels)
paddingTopNumbercheckedcheckedThe top padding (in pixels)
textStringcheckedcheckedThe plain text shown on the label
wrapBooleancheckedcheckedWhether to wrap the text if the label is not wide enough

Methods

NameDescription
setPaddingSets the padding on more than one side. This method can be called with 1, 2 or 4 arguments. In case of 1 argument it sets the padding on all sides. If 2 arguments are used then the padding on the left/right and top/bottom are set to the same. And if called with 4 all 4 sides can have different padding,

setPadding(nPadding) - Sets the padding on all sides to nPadding
setPadding(nLeftRight, nTopBottom) - Sets the padding on the left and right to nLeftRight and the padding on the top and bottom to nTopBottom
setPadding(nLeft, nRight, nTop, nBottom) - Sets the padding on all sides to nLeft, nRight, nTop and nBottom respectively.

Events

None.

Static Methods

NameDescription
addMnemonicChanges an HTML string to designate a character as a mnemonic
htmlToTextStrips HTML markup from an HTML string and returns a plain text string
textToHtmlConverts a plain text string to HTML. This includes adding line breaks and entities.

Static Fields

None.

Remarks

To change the font of the component you have to use setFont(). Changing the font object without calling setFont() will not update the component. To change the icon of the component you have to use setIcon(). Changing the image object without calling setIcon() will not update the component.

Method Details

setPadding

Sets the padding on more than one side. This method can be called with 1, 2 or 4 arguments. In case of 1 argument it sets the padding on all sides. If 2 arguments are used then the padding on the left/right and top/bottom are set to the same. And if called with 4 all 4 sides can have different padding,

setPadding(nPadding) - Sets the padding on all sides to nPadding
setPadding(nLeftRight, nTopBottom) - Sets the padding on the left and right to nLeftRight and the padding on the top and bottom to nTopBottom
setPadding(nLeft, nRight, nTop, nBottom) - Sets the padding on all sides to nLeft, nRight, nTop and nBottom respectively.

Syntax

object.setPadding ( nLeft [ ,nRight [ ,nTop [ ,nBottom ] ] ] )

Parameters

NameTypeOptionalDefaultDescripton
nLeftNumberLeft padding
nRightNumbercheckedRight padding
nTopNumbercheckedTop padding
nBottomNumbercheckedBottom padding

Return Type

void

Static Method Details

addMnemonic

Changes an HTML string to designate a character as a mnemonic

Syntax

BiLabel . addMnemonic ( sHtml,sMnemonic )

Parameters

NameTypeOptionalDefaultDescripton
sHtmlStringThe HTML text to add the mnemonic to
sMnemonicStringThe mnemonic character

Return Type

String

htmlToText

Strips HTML markup from an HTML string and returns a plain text string

Syntax

BiLabel . htmlToText ( s )

Parameters

NameTypeOptionalDefaultDescripton
sStringThe HTML string to convert

Return Type

String

textToHtml

Converts a plain text string to HTML. This includes adding line breaks and entities.

Syntax

BiLabel . textToHtml ( s )

Parameters

NameTypeOptionalDefaultDescripton
sStringThe plain text string to convert

Return Type

String