Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.client.ui
Class Label

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.Label

All Implemented Interfaces:
  HasDirection, EventListener, HasHorizontalAlignment, HasText, HasWordWrap, SourcesClickEvents, SourcesMouseEvents, SourcesMouseWheelEvents

Direct Known Subclasses:
  HTML

    public class Label

extends Widget
implements SourcesClickEvents, SourcesMouseEvents, SourcesMouseWheelEvents, HasHorizontalAlignment, HasText, HasWordWrap, HasDirection

A widget that contains arbitrary text, not interpreted as HTML.

### CSS Style Rules

- .gwt-Label { }

### Example

>     public class HTMLExample implements EntryPoint {

>       public void onModuleLoad() {
>         // Create a Label and an HTML widget.
>         Label lbl = new Label("This is just text.  It will not be interpreted "
>           + "as .");

>         HTML html = new HTML(
>           "This is HTML.  It will be interpreted as such if you specify "
>             + "the asHTML flag.", true);

>         // Add them to the root panel.
>         VerticalPanel panel = new VerticalPanel();
>         panel.add(lbl);
>         panel.add(html);
>         RootPanel.get().add(panel);
>       }
>     }

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
`HasHorizontalAlignment.HorizontalAlignmentConstant`

Nested classes/interfaces inherited from interface com.google.gwt.i18n.client.HasDirection
`HasDirection.Direction`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
`ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT`

Constructor Summary
`Label()` Creates an empty label.
`Label(java.lang.String text)` Creates a label with the specified text.
`Label(java.lang.String text, boolean wordWrap)` Creates a label with the specified text.

Method Summary
`void` | `addClickListener(ClickListener listener)` Adds a listener interface to receive click events.
`void` | `addMouseListener(MouseListener listener)` Adds a listener interface to receive mouse events.
`void` | `addMouseWheelListener(MouseWheelListener listener)` Adds a listener interface to receive mouse events.
`HasDirection.Direction` | `getDirection()` Gets the directionality of the widget.
`HasHorizontalAlignment.HorizontalAlignmentConstant` | `getHorizontalAlignment()` Gets the horizontal alignment.
`java.lang.String` | `getText()` Gets this object's text.
`boolean` | `getWordWrap()` Gets whether word-wrapping is enabled.
`void` | `onBrowserEvent(Event event)` Fired whenever a browser event is received.
`void` | `removeClickListener(ClickListener listener)` Removes a previously added listener interface.
`void` | `removeMouseListener(MouseListener listener)` Removes a previously added listener interface.
`void` | `removeMouseWheelListener(MouseWheelListener listener)` Removes a previously added listener interface.
`void` | `setDirection(HasDirection.Direction direction)` Sets the directionality for a widget.
`void` | `setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)` Sets the horizontal alignment.
`void` | `setText(java.lang.String text)` Sets this object's text.
`void` | `setWordWrap(boolean wrap)` Sets whether word-wrapping is enabled.

Methods inherited from class com.google.gwt.user.client.ui.Widget
`doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Label

    public Label()

  Creates an empty label.

### Label

    public Label(java.lang.String text)

  Creates a label with the specified text.

  Parameters:
    `text` - the new label's text

### Label

    public Label(java.lang.String text,
                 boolean wordWrap)

  Creates a label with the specified text.

  Parameters:
    `text` - the new label's text
    `wordWrap` - `false` to disable word wrapping

Method Detail

### addClickListener

    public void addClickListener(ClickListener listener)

  Description copied from interface: `SourcesClickEvents`
  Adds a listener interface to receive click events.

  Specified by:
    `addClickListener` in interface `SourcesClickEvents`
  Parameters:
    `listener` - the listener interface to add

### addMouseListener

    public void addMouseListener(MouseListener listener)

  Description copied from interface: `SourcesMouseEvents`
  Adds a listener interface to receive mouse events.

  Specified by:
    `addMouseListener` in interface `SourcesMouseEvents`
  Parameters:
    `listener` - the listener interface to add

### addMouseWheelListener

    public void addMouseWheelListener(MouseWheelListener listener)

  Description copied from interface: `SourcesMouseWheelEvents`
  Adds a listener interface to receive mouse events.

  Specified by:
    `addMouseWheelListener` in interface `SourcesMouseWheelEvents`
  Parameters:
    `listener` - the listener interface to add

### getDirection

    public HasDirection.Direction getDirection()

  Description copied from interface: `HasDirection`
  Gets the directionality of the widget.

  Specified by:
    `getDirection` in interface `HasDirection`
  Returns:
    `RTL` if the directionality is right-to-left, `LTR` if the directionality is left-to-right, or `DEFAULT` if the directionality is not explicitly specified

### getHorizontalAlignment

    public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()

  Description copied from interface: `HasHorizontalAlignment`
  Gets the horizontal alignment.

  Specified by:
    `getHorizontalAlignment` in interface `HasHorizontalAlignment`
  Returns:
    the current horizontal alignment.

### getText

    public java.lang.String getText()

  Description copied from interface: `HasText`
  Gets this object's text.

  Specified by:
    `getText` in interface `HasText`
  Returns:
    the object's text

### getWordWrap

    public boolean getWordWrap()

  Description copied from interface: `HasWordWrap`
  Gets whether word-wrapping is enabled.

  Specified by:
    `getWordWrap` in interface `HasWordWrap`
  Returns:
    `true` if word-wrapping is enabled.

### onBrowserEvent

    public void onBrowserEvent(Event event)

  Description copied from interface: `EventListener`
  Fired whenever a browser event is received.

  Specified by:
    `onBrowserEvent` in interface `EventListener`
  Overrides:
    `onBrowserEvent` in class `Widget`
  Parameters:
    `event` - the event received

### removeClickListener

    public void removeClickListener(ClickListener listener)

  Description copied from interface: `SourcesClickEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeClickListener` in interface `SourcesClickEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeMouseListener

    public void removeMouseListener(MouseListener listener)

  Description copied from interface: `SourcesMouseEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeMouseListener` in interface `SourcesMouseEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeMouseWheelListener

    public void removeMouseWheelListener(MouseWheelListener listener)

  Description copied from interface: `SourcesMouseWheelEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeMouseWheelListener` in interface `SourcesMouseWheelEvents`
  Parameters:
    `listener` - the listener interface to remove

### setDirection

    public void setDirection(HasDirection.Direction direction)

  Description copied from interface: `HasDirection`
  Sets the directionality for a widget.

  Specified by:
    `setDirection` in interface `HasDirection`
  Parameters:
    `direction` - `RTL` if the directionality should be set to right-to-left, `LTR` if the directionality should be set to left-to-right `DEFAULT` if the directionality should not be explicitly set

### setHorizontalAlignment

    public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)

  Description copied from interface: `HasHorizontalAlignment`
  Sets the horizontal alignment.

  Specified by:
    `setHorizontalAlignment` in interface `HasHorizontalAlignment`
  Parameters:
    `align` - the horizontal alignment ( `HasHorizontalAlignment.ALIGN_LEFT`, `HasHorizontalAlignment.ALIGN_CENTER`, `HasHorizontalAlignment.ALIGN_RIGHT`), or `HasHorizontalAlignment.ALIGN_DEFAULT`).

### setText

    public void setText(java.lang.String text)

  Description copied from interface: `HasText`
  Sets this object's text.

  Specified by:
    `setText` in interface `HasText`
  Parameters:
    `text` - the object's new text

### setWordWrap

    public void setWordWrap(boolean wrap)

  Description copied from interface: `HasWordWrap`
  Sets whether word-wrapping is enabled.

  Specified by:
    `setWordWrap` in interface `HasWordWrap`
  Parameters:
    `wrap` - `true` to enable word-wrapping.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD