Class java.awt.Label
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Label
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Label
- public class Label
- extends Component
A component that displays a single line of read-only text.
- CENTER
- The center alignment.
- LEFT
- The left alignment.
- RIGHT
- The right alignment.
- Label()
- Constructs an empty label.
- Label(String)
- Constructs a new label with the specified String of text.
- Label(String, int)
- Constructs a new label with the specified String of text and the specified alignment.
- addNotify()
- Creates the peer for this label.
- getAlignment()
- Gets the current alignment of this label.
- getText()
- Gets the text of this label.
- paramString()
- Returns the parameter String of this label.
- setAlignment(int)
- Sets the alignment for this label to the specified alignment.
- setText(String)
- Sets the text for this label to the specified text.
LEFT
public final static int LEFT
- The left alignment.
CENTER
public final static int CENTER
- The center alignment.
RIGHT
public final static int RIGHT
- The right alignment.
Label
public Label()
- Constructs an empty label.
Label
public Label(String label)
- Constructs a new label with the specified String of text.
- Parameters:
- label - the text that makes up the label
Label
public Label(String label,
int alignment)
- Constructs a new label with the specified String of text and the specified alignment.
- Parameters:
- label - the String that makes up the label
- alignment - the alignment value
addNotify
public synchronized void addNotify()
- Creates the peer for this label. The peer allows us to
modify the appearance of the label without changing its functionality.
- Overrides:
- addNotify in class Component
getAlignment
public int getAlignment()
- Gets the current alignment of this label.
- See Also:
- setAlignment
setAlignment
public void setAlignment(int alignment)
- Sets the alignment for this label to the specified alignment.
- Parameters:
- alignment - the alignment value
- Throws: IllegalArgumentException
- If an improper alignment was given.
- See Also:
- getAlignment
getText
public String getText()
- Gets the text of this label.
- See Also:
- setText
setText
public void setText(String label)
- Sets the text for this label to the specified text.
- Parameters:
- label - the text that makes up the label
- See Also:
- getText
paramString
protected String paramString()
- Returns the parameter String of this label.
- Overrides:
- paramString in class Component
All Packages Class Hierarchy This Package Previous Next Index