All Packages Class Hierarchy This Package Previous Next Index
Class jp.kyasu.awt.Label
java.lang.Object
|
+----java.awt.Component
|
+----jp.kyasu.awt.KComponent
|
+----jp.kyasu.awt.Label
- public class Label
- extends KComponent
A Label
object is a component for placing text in a
container. A label displays a single line of read-only text.
The text can be changed by the application, but a user cannot edit it
directly.
A Label can also display a visual object in a container.
For example:
setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
add(new Label("A Label"));
add(new Label(
new Text(
"Another Label",
new TextStyle("Dialog", Font.BOLD, 12, Color.red))));
add(new Label(new VImage("image.gif")));
- Version:
- 21 Aug 1998
- Author:
- Kazuki YASUMATSU
- See Also:
- Visualizable, VLabel
-
CENTER
- Indicates that the label should be centered.
-
EAST
- Indicates that the label should be right.
-
LEFT
- Indicates that the label should be left justified.
-
NORTH
- Indicates that the label should be top.
-
NORTHEAST
- Indicates that the label should be top-right.
-
NORTHWEST
- Indicates that the label should be top-left.
-
RIGHT
- Indicates that the label should be right justified.
-
SOUTH
- Indicates that the label should be bottom.
-
SOUTHEAST
- Indicates that the label should be bottom-right.
-
SOUTHWEST
- Indicates that the label should be bottom-left.
-
WEST
- Indicates that the label should be left.
-
Label()
- Constructs an empty label.
-
Label(String)
- Constructs a new label with the specified string, left justified.
-
Label(String, int)
- Constructs a new label that presents the specified string with the
specified alignment.
-
Label(Text)
- Constructs a new label with the specified text, left justified.
-
Label(Text, int)
- Constructs a new label that presents the specified string with the
specified alignment.
-
Label(Visualizable)
- Constructs a new label with the specified visual object, left justified.
-
Label(Visualizable, int)
- Constructs a new label with the specified visual object with the
specified alignment.
-
Label(VLabel)
- Constructs a new label with the specified visual label, left justified.
-
Label(VLabel, int)
- Constructs a new label with the specified visual label with the
specified alignment.
-
getAlignment()
- Gets the current alignment of this label.
-
getMinimumSize()
- Gets the mininimum size of this component.
-
getPreferredSize()
- Gets the preferred size of this component.
-
getText()
- Gets the string of this label.
-
getTEXT()
- Gets the text object of this label.
-
getVisualizable()
- Gets the visual object of this label.
-
getVLabel()
- Gets the visual label of this label.
-
setAlignment(int)
- Sets the alignment for this label to the specified alignment.
-
setBackground(Color)
- Sets the background color of this component.
-
setBounds(int, int, int, int)
- Moves and resizes this component.
-
setEnabled(boolean)
- Enables or disables this component.
-
setFont(Font)
- Sets the font of this component.
-
setForeground(Color)
- Sets the foreground color of this component.
-
setText(String)
- Sets the text for this label to the specified string.
-
setText(Text)
- Sets the text object for this label to the specified text object.
-
setTEXT(Text)
- Sets the text object for this label to the specified text object.
-
setVisualizable(Visualizable)
- Sets the visual object for this label to the specified visual object.
-
setVLabel(VLabel)
- Sets the visual label for this label to the specified viaul label.
LEFT
public static final int LEFT
- Indicates that the label should be left justified.
CENTER
public static final int CENTER
- Indicates that the label should be centered.
RIGHT
public static final int RIGHT
- Indicates that the label should be right justified.
NORTH
public static final int NORTH
- Indicates that the label should be top.
NORTHEAST
public static final int NORTHEAST
- Indicates that the label should be top-right.
EAST
public static final int EAST
- Indicates that the label should be right.
SOUTHEAST
public static final int SOUTHEAST
- Indicates that the label should be bottom-right.
SOUTH
public static final int SOUTH
- Indicates that the label should be bottom.
SOUTHWEST
public static final int SOUTHWEST
- Indicates that the label should be bottom-left.
WEST
public static final int WEST
- Indicates that the label should be left.
NORTHWEST
public static final int NORTHWEST
- Indicates that the label should be top-left.
Label
public Label()
- Constructs an empty label.
Label
public Label(String str)
- Constructs a new label with the specified string, left justified.
- Parameters:
- str - the string that the label presents.
Label
public Label(String str,
int alignment)
- Constructs a new label that presents the specified string with the
specified alignment.
- Parameters:
- str - the string that the label presents.
- alignment - the alignment value.
Label
public Label(Text text)
- Constructs a new label with the specified text, left justified.
- Parameters:
- text - the text that the label presents.
Label
public Label(Text text,
int alignment)
- Constructs a new label that presents the specified string with the
specified alignment.
- Parameters:
- text - the text that the label presents.
- alignment - the alignment value.
Label
public Label(Visualizable visualizable)
- Constructs a new label with the specified visual object, left justified.
- Parameters:
- visualizable - the visual object that the label presents.
Label
public Label(Visualizable visualizable,
int alignment)
- Constructs a new label with the specified visual object with the
specified alignment.
- Parameters:
- visualizable - the visual object that the label presents.
- alignment - the alignment value.
Label
public Label(VLabel label)
- Constructs a new label with the specified visual label, left justified.
- Parameters:
- label - the visual label that the label presents.
Label
public Label(VLabel label,
int alignment)
- Constructs a new label with the specified visual label with the
specified alignment.
- Parameters:
- label - the visual label that the label presents.
- alignment - the alignment value.
setFont
public synchronized void setFont(Font f)
- Sets the font of this component.
- Overrides:
- setFont in class Component
getPreferredSize
public Dimension getPreferredSize()
- Gets the preferred size of this component.
- Overrides:
- getPreferredSize in class KComponent
getMinimumSize
public Dimension getMinimumSize()
- Gets the mininimum size of this component.
- Overrides:
- getMinimumSize in class KComponent
setForeground
public synchronized void setForeground(Color c)
- Sets the foreground color of this component.
- Overrides:
- setForeground in class KComponent
setBackground
public synchronized void setBackground(Color c)
- Sets the background color of this component.
- Overrides:
- setBackground in class KComponent
setEnabled
public synchronized void setEnabled(boolean b)
- Enables or disables this component.
- Overrides:
- setEnabled in class KComponent
setBounds
public synchronized void setBounds(int x,
int y,
int width,
int height)
- Moves and resizes this component.
- Overrides:
- setBounds in class KComponent
getAlignment
public int getAlignment()
- Gets the current alignment of this label.
- See Also:
- setAlignment
setAlignment
public synchronized void setAlignment(int alignment)
- Sets the alignment for this label to the specified alignment.
- Parameters:
- alignment - the alignment to be set.
- Throws: IllegalArgumentException
- if an improper value for
alignment
is given.
- See Also:
- getAlignment
getText
public String getText()
- Gets the string of this label.
- See Also:
- setText
setText
public void setText(String str)
- Sets the text for this label to the specified string.
- Parameters:
- str - the string that this label presents.
- See Also:
- getText
getTEXT
public synchronized Text getTEXT()
- Gets the text object of this label.
- Returns:
- the text object, or empty text object if the visual object
of this label does not contain the text object.
- See Also:
- setTEXT, setText
setTEXT
public void setTEXT(Text text)
- Sets the text object for this label to the specified text object.
- Parameters:
- text - the text object that this label presents.
- See Also:
- getTEXT
setText
public void setText(Text text)
- Sets the text object for this label to the specified text object.
- Parameters:
- text - the text object that this label presents.
- See Also:
- getTEXT
getVisualizable
public Visualizable getVisualizable()
- Gets the visual object of this label.
- Returns:
- the visual object of this label.
- See Also:
- setVisualizable
setVisualizable
public void setVisualizable(Visualizable visualizable)
- Sets the visual object for this label to the specified visual object.
- Parameters:
- visualizable - the visual object that this label presents.
- See Also:
- getVisualizable
getVLabel
public VLabel getVLabel()
- Gets the visual label of this label.
- Returns:
- the visual label of this label.
- See Also:
- setVLabel
setVLabel
public synchronized void setVLabel(VLabel label)
- Sets the visual label for this label to the specified viaul label.
- Parameters:
- label - the visual label that this label presents.
- See Also:
- getVLabel
All Packages Class Hierarchy This Package Previous Next Index