NextApp Echo2
v2.1.0

nextapp.echo2.app
Class Label

java.lang.Object
  extended by nextapp.echo2.app.Component
      extended by nextapp.echo2.app.Label
All Implemented Interfaces:
java.io.Serializable, RenderIdSupport

public class Label
extends Component

A component which displays a text string, an icon, or both.

See Also:
Serialized Form

Field Summary
static java.lang.String PROPERTY_ICON
           
static java.lang.String PROPERTY_ICON_TEXT_MARGIN
           
static java.lang.String PROPERTY_LINE_WRAP
           
static java.lang.String PROPERTY_TEXT
           
static java.lang.String PROPERTY_TEXT_ALIGNMENT
           
static java.lang.String PROPERTY_TEXT_POSITION
           
static java.lang.String PROPERTY_TOOL_TIP_TEXT
           
 
Fields inherited from class nextapp.echo2.app.Component
CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
Label()
          Creates a label with no text or icon.
Label(ImageReference icon)
          Creates a label with an icon.
Label(java.lang.String text)
          Creates a label with text.
Label(java.lang.String text, ImageReference icon)
          Creates a label with text and an icon.
 
Method Summary
 ImageReference getIcon()
          Returns the icon of the label.
 Extent getIconTextMargin()
          Returns the margin size between the icon and the text.
 java.lang.String getText()
          Returns the text of the label.
 Alignment getTextAlignment()
          Returns the alignment of the text relative to the icon.
 Alignment getTextPosition()
          Returns the position of the text relative to the icon.
 java.lang.String getToolTipText()
          Returns the tool tip text (displayed when the mouse cursor is hovered over the component).
 boolean isLineWrap()
          Determines if the text of the label should wrap in the event that horizontal space is limited.
 boolean isValidChild(Component component)
          This component does not support children.
 void setIcon(ImageReference newValue)
          Sets the icon to be displayed.
 void setIconTextMargin(Extent newValue)
          Sets the margin size between the icon and the text.
 void setLineWrap(boolean newValue)
          Sets whether the text of the label should wrap in the event that horizontal space is limited.
 void setText(java.lang.String newValue)
          Sets the text to be displayed.
 void setTextAlignment(Alignment newValue)
          Sets the alignment of the text relative to the icon.
 void setTextPosition(Alignment newValue)
          Sets the position of the text relative to the icon.
 void setToolTipText(java.lang.String newValue)
          Sets the tool tip text (displayed when the mouse cursor is hovered over the component).
 
Methods inherited from class nextapp.echo2.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, processInput, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_ICON

public static final java.lang.String PROPERTY_ICON
See Also:
Constant Field Values

PROPERTY_ICON_TEXT_MARGIN

public static final java.lang.String PROPERTY_ICON_TEXT_MARGIN
See Also:
Constant Field Values

PROPERTY_LINE_WRAP

public static final java.lang.String PROPERTY_LINE_WRAP
See Also:
Constant Field Values

PROPERTY_TEXT

public static final java.lang.String PROPERTY_TEXT
See Also:
Constant Field Values

PROPERTY_TEXT_ALIGNMENT

public static final java.lang.String PROPERTY_TEXT_ALIGNMENT
See Also:
Constant Field Values

PROPERTY_TEXT_POSITION

public static final java.lang.String PROPERTY_TEXT_POSITION
See Also:
Constant Field Values

PROPERTY_TOOL_TIP_TEXT

public static final java.lang.String PROPERTY_TOOL_TIP_TEXT
See Also:
Constant Field Values
Constructor Detail

Label

public Label()
Creates a label with no text or icon.


Label

public Label(java.lang.String text)
Creates a label with text.

Parameters:
text - the text to be displayed

Label

public Label(ImageReference icon)
Creates a label with an icon.

Parameters:
icon - the icon to be displayed

Label

public Label(java.lang.String text,
             ImageReference icon)
Creates a label with text and an icon.

Parameters:
text - the text to be displayed
icon - the icon to be displayed
Method Detail

getIcon

public ImageReference getIcon()
Returns the icon of the label.

Returns:
the icon

getIconTextMargin

public Extent getIconTextMargin()
Returns the margin size between the icon and the text. The margin will only be displayed if the label has both icon and text properties set.

Returns:
the margin size

getText

public java.lang.String getText()
Returns the text of the label.

Returns:
the text

getTextAlignment

public Alignment getTextAlignment()
Returns the alignment of the text relative to the icon.

Returns:
the text alignment

getTextPosition

public Alignment getTextPosition()
Returns the position of the text relative to the icon.

Returns:
the text position

getToolTipText

public java.lang.String getToolTipText()
Returns the tool tip text (displayed when the mouse cursor is hovered over the component).

Returns:
the tool tip text

isLineWrap

public boolean isLineWrap()
Determines if the text of the label should wrap in the event that horizontal space is limited. Default value is true.

Returns:
the line wrap state

isValidChild

public boolean isValidChild(Component component)
This component does not support children.

Overrides:
isValidChild in class Component
Parameters:
component - the Component to evaluate as a child
Returns:
true if the Component is a valid child
See Also:
Component.isValidChild(nextapp.echo2.app.Component)

setIcon

public void setIcon(ImageReference newValue)
Sets the icon to be displayed.

Parameters:
newValue - the icon to be displayed

setIconTextMargin

public void setIconTextMargin(Extent newValue)
Sets the margin size between the icon and the text. The margin will only be displayed if the label has both icon and text properties set.

Parameters:
newValue - the margin size

setLineWrap

public void setLineWrap(boolean newValue)
Sets whether the text of the label should wrap in the event that horizontal space is limited. Default value is true.

Parameters:
newValue - the new line wrap state

setText

public void setText(java.lang.String newValue)
Sets the text to be displayed.

Parameters:
newValue - the text to be displayed

setTextAlignment

public void setTextAlignment(Alignment newValue)
Sets the alignment of the text relative to the icon. Note that only one of the provided Alignment's settings should be non-default.

Parameters:
newValue - the new text position

setTextPosition

public void setTextPosition(Alignment newValue)
Sets the position of the text relative to the icon. Note that only one of the provided Alignment's settings should be non-default.

Parameters:
newValue - the new text position

setToolTipText

public void setToolTipText(java.lang.String newValue)
Sets the tool tip text (displayed when the mouse cursor is hovered over the component).

Parameters:
newValue - the new tool tip text

NextApp Echo2
v2.1.0