java.awt
public class Label extends Component implements Accessible
Nested Class Summary | |
---|---|
protected class | Label.AccessibleAWTLabel
This class provides accessibility support for the label. |
Field Summary | |
---|---|
static int | CENTER
Alignment constant aligning the text in the center of its window. |
static int | LEFT
Alignment constant aligning the text to the left of its window. |
static int | RIGHT
Alignment constant aligning the text to the right of its window. |
Constructor Summary | |
---|---|
Label()
Initializes a new instance of Label with no text.
| |
Label(String text)
Initializes a new instance of Label with the specified
text that is aligned to the left.
| |
Label(String text, int alignment)
Initializes a new instance of Label with the specified
text and alignment.
|
Method Summary | |
---|---|
void | addNotify()
Notifies this label that it has been added to a container, causing
the peer to be created. |
AccessibleContext | getAccessibleContext()
Gets the AccessibleContext associated with this Label .
|
int | getAlignment()
Returns the constant indicating the alignment of the text in this
label. |
String | getText()
Returns the text displayed in this label.
|
protected String | paramString()
Returns a parameter string useful for debugging.
|
void | setAlignment(int alignment)
Sets the text alignment of this label to the specified value.
|
void | setText(String text)
Sets the text in this label to the specified value.
|
Label
with no text.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true.
Label
with the specified
text that is aligned to the left.
Parameters: text The text of the label.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true.
Label
with the specified
text and alignment.
Parameters: text The text of the label. alignment The desired alignment for the text in this label,
which must be one of LEFT
, CENTER
, or
RIGHT
.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true.
Label
.
The context is created, if necessary.
Returns: the associated context
Returns: The alignment of the text in the label.
Returns: The text for this label.
Returns: A debugging string.
Parameters: alignment The desired alignment for the text in this label,
which must be one of LEFT
, CENTER
, or
RIGHT
.
Parameters: text The new text for this label.