Label Class

Label Class

This Package | All Packages

Component
  |
  +--Control
    |
    +--Label
public class Label
extends Control

Implements a simple static label control. Label controls are typically used to either display status text to the user or to identify the purpose of other controls that don't have an associated label. When a Label control gets the focus, it passes that focus to the next control in the tab order. This allows you to specify a mnemonic key for the label and have this key jump to other controls.

Constructors
Name Description
Label() Default constructor.

Methods
Name Description
getAlignment() Retrieves the alignment mode of the label.
getBorder() Indicates whether the label has a visible border.
getUseMnemonic() Indicates whether the label interprets the first ampersand (&) character as a hotkey mnemonic.
setAlignment(int alignment) Sets the alignment mode for the label.
setBorder(boolean border) Determines whether this control has a visible border.
setUseMnemonic(boolean useMnemonic) Determines whether this control will use the first ampersand (&) in its text as a hotkey mnemonic.

Constructors

Label.Label

Syntax
public Label();
Description

Default constructor.

Methods

Label.getAlignment

Syntax
public int getAlignment();
Return Value

Returns a HorizontalAlignment enum.

Description

Retrieves the alignment mode of the label. This will be one of the HorizontalAlignment enum values.

Label.getBorder

Syntax
public boolean getBorder();
Return Value

Returns true if the label has a visible border; otherwise, returns false.

Description

Indicates whether the label has a visible border.

Label.getUseMnemonic

Syntax
public boolean getUseMnemonic();
Return Value

Returns true if the label uses mnemonics defined in its text; otherwise, returns false.

Description

Indicates whether the label interprets the first ampersand (&) character as a hotkey mnemonic.

Label.setAlignment

Syntax
public void setAlignment( int alignment );
Parameters
alignment
A value from the HorizontalAlignmnent enum.
Description

Sets the alignment mode for the label.

Label.setBorder

Syntax
public void setBorder( boolean border );
Parameters
border
Set to true if the control is to have a visible border; otherwise, set to false.
Description

Determines whether this control has a visible border.

Label.setUseMnemonic

Syntax
public void setUseMnemonic( boolean useMnemonic );
Parameters
useMnemonic
Set to true if the control is to interpret its text as a mnemonic; otherwise, set to false.
Description

Determines whether this control will use the first ampersand (&) in its text as a hotkey mnemonic.