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

Variable Index

 o CENTER
Indicates that the label should be centered.
 o EAST
Indicates that the label should be right.
 o LEFT
Indicates that the label should be left justified.
 o NORTH
Indicates that the label should be top.
 o NORTHEAST
Indicates that the label should be top-right.
 o NORTHWEST
Indicates that the label should be top-left.
 o RIGHT
Indicates that the label should be right justified.
 o SOUTH
Indicates that the label should be bottom.
 o SOUTHEAST
Indicates that the label should be bottom-right.
 o SOUTHWEST
Indicates that the label should be bottom-left.
 o WEST
Indicates that the label should be left.

Constructor Index

 o Label()
Constructs an empty label.
 o Label(String)
Constructs a new label with the specified string, left justified.
 o Label(String, int)
Constructs a new label that presents the specified string with the specified alignment.
 o Label(Text)
Constructs a new label with the specified text, left justified.
 o Label(Text, int)
Constructs a new label that presents the specified string with the specified alignment.
 o Label(Visualizable)
Constructs a new label with the specified visual object, left justified.
 o Label(Visualizable, int)
Constructs a new label with the specified visual object with the specified alignment.
 o Label(VLabel)
Constructs a new label with the specified visual label, left justified.
 o Label(VLabel, int)
Constructs a new label with the specified visual label with the specified alignment.

Method Index

 o getAlignment()
Gets the current alignment of this label.
 o getMinimumSize()
Gets the mininimum size of this component.
 o getPreferredSize()
Gets the preferred size of this component.
 o getText()
Gets the string of this label.
 o getTEXT()
Gets the text object of this label.
 o getVisualizable()
Gets the visual object of this label.
 o getVLabel()
Gets the visual label of this label.
 o setAlignment(int)
Sets the alignment for this label to the specified alignment.
 o setBackground(Color)
Sets the background color of this component.
 o setBounds(int, int, int, int)
Moves and resizes this component.
 o setEnabled(boolean)
Enables or disables this component.
 o setFont(Font)
Sets the font of this component.
 o setForeground(Color)
Sets the foreground color of this component.
 o setText(String)
Sets the text for this label to the specified string.
 o setText(Text)
Sets the text object for this label to the specified text object.
 o setTEXT(Text)
Sets the text object for this label to the specified text object.
 o setVisualizable(Visualizable)
Sets the visual object for this label to the specified visual object.
 o setVLabel(VLabel)
Sets the visual label for this label to the specified viaul label.

Variables

 o LEFT
 public static final int LEFT
Indicates that the label should be left justified.

 o CENTER
 public static final int CENTER
Indicates that the label should be centered.

 o RIGHT
 public static final int RIGHT
Indicates that the label should be right justified.

 o NORTH
 public static final int NORTH
Indicates that the label should be top.

 o NORTHEAST
 public static final int NORTHEAST
Indicates that the label should be top-right.

 o EAST
 public static final int EAST
Indicates that the label should be right.

 o SOUTHEAST
 public static final int SOUTHEAST
Indicates that the label should be bottom-right.

 o SOUTH
 public static final int SOUTH
Indicates that the label should be bottom.

 o SOUTHWEST
 public static final int SOUTHWEST
Indicates that the label should be bottom-left.

 o WEST
 public static final int WEST
Indicates that the label should be left.

 o NORTHWEST
 public static final int NORTHWEST
Indicates that the label should be top-left.

Constructors

 o Label
 public Label()
Constructs an empty label.

 o Label
 public Label(String str)
Constructs a new label with the specified string, left justified.

Parameters:
str - the string that the label presents.
 o 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.
 o Label
 public Label(Text text)
Constructs a new label with the specified text, left justified.

Parameters:
text - the text that the label presents.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.

Methods

 o setFont
 public synchronized void setFont(Font f)
Sets the font of this component.

Overrides:
setFont in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Gets the preferred size of this component.

Overrides:
getPreferredSize in class KComponent
 o getMinimumSize
 public Dimension getMinimumSize()
Gets the mininimum size of this component.

Overrides:
getMinimumSize in class KComponent
 o setForeground
 public synchronized void setForeground(Color c)
Sets the foreground color of this component.

Overrides:
setForeground in class KComponent
 o setBackground
 public synchronized void setBackground(Color c)
Sets the background color of this component.

Overrides:
setBackground in class KComponent
 o setEnabled
 public synchronized void setEnabled(boolean b)
Enables or disables this component.

Overrides:
setEnabled in class KComponent
 o setBounds
 public synchronized void setBounds(int x,
                                    int y,
                                    int width,
                                    int height)
Moves and resizes this component.

Overrides:
setBounds in class KComponent
 o getAlignment
 public int getAlignment()
Gets the current alignment of this label.

See Also:
setAlignment
 o 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
 o getText
 public String getText()
Gets the string of this label.

See Also:
setText
 o 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
 o 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
 o 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
 o 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
 o getVisualizable
 public Visualizable getVisualizable()
Gets the visual object of this label.

Returns:
the visual object of this label.
See Also:
setVisualizable
 o 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
 o getVLabel
 public VLabel getVLabel()
Gets the visual label of this label.

Returns:
the visual label of this label.
See Also:
setVLabel
 o 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