## 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:
  EventListener, HasHorizontalAlignment, HasText, HasWordWrap, SourcesClickEvents, SourcesMouseEvents, SourcesMouseWheelEvents

Direct Known Subclasses:
  HTML

public class Label
extends Widget
implements SourcesClickEvents, SourcesMouseEvents, SourcesMouseWheelEvents, HasHorizontalAlignment, HasText, HasWordWrap

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 inherited from class com.google.gwt.user.client.ui.HasHorizontalAlignment
`HasHorizontalAlignment.HorizontalAlignmentConstant`

Field Summary

Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
`ALIGN_CENTER, 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.
`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` `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
`getParent, isAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent, setElement`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getTitle, isVisible, isVisible, removeStyleName, resetStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, 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

### 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`

### 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

### 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`, or `HasHorizontalAlignment.ALIGN_RIGHT`).

### 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.