|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Label
public class Label
This component is used for displaying simple text strings that cannot be edited by the user.
Nested Class Summary | |
---|---|
protected class |
Label.AccessibleAWTLabel
This class provides accessibility support for the label. |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
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. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int LEFT
public static final int CENTER
public static final int RIGHT
Constructor Detail |
---|
public Label()
Label
with no text.
HeadlessException
- If GraphicsEnvironment.isHeadless() is true.public Label(String text)
Label
with the specified
text that is aligned to the left.
text
- The text of the label.
HeadlessException
- If GraphicsEnvironment.isHeadless() is true.public Label(String text, int alignment)
Label
with the specified
text and alignment.
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
.
HeadlessException
- If GraphicsEnvironment.isHeadless() is true.Method Detail |
---|
public int getAlignment()
public void setAlignment(int alignment)
alignment
- The desired alignment for the text in this label,
which must be one of LEFT
, CENTER
, or
RIGHT
.public String getText()
public void setText(String text)
text
- The new text for this label.public void addNotify()
addNotify
in class Component
Component.isDisplayable()
,
Component.removeNotify()
protected String paramString()
paramString
in class Component
public AccessibleContext getAccessibleContext()
Label
.
The context is created, if necessary.
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |