java::awt::Label Class Reference

Inheritance diagram for java::awt::Label:

Inheritance graph
java::awt::Componentjava::lang::Objectjava::lang::Interfacejava::lang::Syncjava::awt::event::ComponentSourcejava::awt::event::FocusSourcejava::awt::event::HierarchySourcejava::awt::event::KeySourcejava::awt::event::MouseSourcejava::awt::event::PaintSourcejava::util::PropertyChangeSourcejava::lang::Lockjava::lang::ScopeAdapterjava::awt::image::ImageObserverjava::util::EventSource
[legend]
Collaboration diagram for java::awt::Label:

Collaboration graph
java::awt::Componentjava::lang::Objectjava::lang::Interfacejava::lang::ObjectRefjava::lang::Syncjava::awt::event::ComponentSourcejava::awt::event::FocusSourcejava::awt::event::HierarchySourcejava::awt::event::KeySourcejava::awt::event::MouseSourcejava::awt::event::PaintSourcejava::util::PropertyChangeSourcejava::lang::Lockjava::lang::ScopeAdapterjava::lang::Comparablejava::awt::image::ImageObserverjava::util::EventSourcejava::util::Collectionjava::util::LinkedListjava::util::AbstractSequentialListjava::util::AbstractListjava::util::AbstractCollectionjava::util::List
[legend]

List of all members.


Detailed Description

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.

For example, the code . . .


<blockquote>
 setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
 add(new Label("Hi There!"));
 add(new Label("Another Label"));
 
</blockquote>

produces the following labels:

Label-1.gif

Version:
1.55, 01/23/03
Author:
Sami Shaio
Since:
JDK1.0

Public Types

enum  ALIGNMENT_MODE { ALIGNMENT_LEFT = 0, ALIGNMENT_CENTER, ALIGNMENT_RIGHT }

Public Member Functions

 Label (const String &text=nilString, jint alignment=ALIGNMENT_LEFT)
 Constructs a new label that presents the specified string of text with the specified alignment.
virtual jint getAlignment () const
 Gets the current alignment of this label.
virtual void setAlignment (jint alignment)
 Sets the alignment for this label to the specified alignment.
virtual String getText () const
 Gets the text of this label.
virtual void setText (const String &text)
 Sets the text for this label to the specified text.

Protected Attributes

 REGISTER_MEMBERS

Member Enumeration Documentation

enum java::awt::Label::ALIGNMENT_MODE

Enumerator:
ALIGNMENT_LEFT  Indicates that the label should be left justified.
ALIGNMENT_CENTER  Indicates that the label should be centered.
ALIGNMENT_RIGHT  Indicates that the label should be right justified.

Since:
JDK1.0t.


Constructor & Destructor Documentation

java::awt::Label::Label ( const String text = nilString,
jint  alignment = ALIGNMENT_LEFT 
)

Constructs a new label that presents the specified string of text with the specified alignment.

Possible values for alignment are Label.LEFT, Label.RIGHT, and Label.CENTER.

Parameters:
text the string that the label presents. A null value will be accepted without causing a NullPointerException to be thrown.
alignment the alignment value.
Exceptions:
HeadlessException if GraphicsEnvironment.isHeadless() returns true.
See also:
java.awt.GraphicsEnvironment::isHeadless


Member Function Documentation

virtual jint java::awt::Label::getAlignment (  )  const [virtual]

Gets the current alignment of this label.

Possible values are Label.LEFT, Label.RIGHT, and Label.CENTER.

See also:
java.awt.Label::setAlignment

virtual void java::awt::Label::setAlignment ( jint  alignment  )  [virtual]

Sets the alignment for this label to the specified alignment.

Possible values are Label.LEFT, Label.RIGHT, and Label.CENTER.

Parameters:
alignment the alignment to be set.
Exceptions:
IllegalArgumentException if an improper value for alignment is given.
See also:
java.awt.Label::getAlignment

virtual String java::awt::Label::getText (  )  const [virtual]

Gets the text of this label.

Returns:
the text of this label, or null if the text has been set to null.
See also:
java.awt.Label::setText

virtual void java::awt::Label::setText ( const String text  )  [virtual]

Sets the text for this label to the specified text.

Parameters:
text the text that this label displays. If text is null, it is treated for display purposes like an empty string "".
See also:
java.awt.Label::getText


Member Data Documentation

java::awt::Label::REGISTER_MEMBERS [protected]

Reimplemented from java::awt::Component.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:03 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3