Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
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:
  HasAllMouseHandlers, HasClickHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasHandlers, HasDirection, EventListener, HasHorizontalAlignment, HasText, HasWordWrap, SourcesClickEvents, SourcesMouseEvents

Direct Known Subclasses:
  HTML, InlineLabel

    public class Label

extends Widget
implements HasHorizontalAlignment, HasText, HasWordWrap, HasDirection, HasClickHandlers, SourcesClickEvents, SourcesMouseEvents, HasAllMouseHandlers

A widget that contains arbitrary text, not interpreted as HTML. This widget uses a <div> element, causing it to be displayed with block layout.

### 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.
`protected` | `Label(Element element)` This constructor may be used by subclasses to explicitly use an existing element.
`` | `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
`HandlerRegistration` | `addClickHandler(ClickHandler handler)` Adds a `ClickEvent` handler.
`void` | `addClickListener(ClickListener listener)` Deprecated. Use `addClickHandler(com.google.gwt.event.dom.client.ClickHandler)` instead
`HandlerRegistration` | `addMouseDownHandler(MouseDownHandler handler)` Adds a `MouseDownEvent` handler.
`void` | `addMouseListener(MouseListener listener)` Deprecated. Use `addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)` `addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler)`, `addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)`, `addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler)` and `addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)` instead
`HandlerRegistration` | `addMouseMoveHandler(MouseMoveHandler handler)` Adds a `MouseMoveEvent` handler.
`HandlerRegistration` | `addMouseOutHandler(MouseOutHandler handler)` Adds a `MouseOutEvent` handler.
`HandlerRegistration` | `addMouseOverHandler(MouseOverHandler handler)` Adds a `MouseOverEvent` handler.
`HandlerRegistration` | `addMouseUpHandler(MouseUpHandler handler)` Adds a `MouseUpEvent` handler.
`HandlerRegistration` | `addMouseWheelHandler(MouseWheelHandler handler)` Adds a `MouseWheelEvent` handler.
`void` | `addMouseWheelListener(MouseWheelListener listener)` Deprecated. Use `addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)` instead
`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` | `removeClickListener(ClickListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `addClickHandler(com.google.gwt.event.dom.client.ClickHandler)` instead
`void` | `removeMouseListener(MouseListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by an add*Handler method instead
`void` | `removeMouseWheelListener(MouseWheelListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)` instead
`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.
`static Label` | `wrap(Element element)` Creates a Label widget that wraps an existing <div> or <span> element.

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents`

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, toString, unsinkEvents`

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

Methods inherited from interface com.google.gwt.event.shared.HasHandlers
`fireEvent`

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

### Label

    protected Label(Element element)

  This constructor may be used by subclasses to explicitly use an existing element. This element must be either a <div> or <span> element.

  Parameters:
    `element` - the element to be used

Method Detail

### wrap

    public static Label wrap(Element element)

  Creates a Label widget that wraps an existing <div> or <span> element. This element must already be attached to the document. If the element is removed from the document, you must call `RootPanel.detachNow(Widget)`.

  Parameters:
    `element` - the element to be wrapped

### addClickHandler

    public HandlerRegistration addClickHandler(ClickHandler handler)

  Description copied from interface: `HasClickHandlers`
  Adds a `ClickEvent` handler.

  Specified by:
    `addClickHandler` in interface `HasClickHandlers`
  Parameters:
    `handler` - the click handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addClickListener

    @Deprecated
    public void addClickListener(ClickListener listener)

  Deprecated. Use `addClickHandler(com.google.gwt.event.dom.client.ClickHandler)` instead

  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

### addMouseDownHandler

    public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)

  Description copied from interface: `HasMouseDownHandlers`
  Adds a `MouseDownEvent` handler.

  Specified by:
    `addMouseDownHandler` in interface `HasMouseDownHandlers`
  Parameters:
    `handler` - the mouse down handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addMouseListener

    @Deprecated
    public void addMouseListener(MouseListener listener)

  Deprecated. Use `addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)` `addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler)`, `addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)`, `addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler)` and `addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)` instead

  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

### addMouseMoveHandler

    public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)

  Description copied from interface: `HasMouseMoveHandlers`
  Adds a `MouseMoveEvent` handler.

  Specified by:
    `addMouseMoveHandler` in interface `HasMouseMoveHandlers`
  Parameters:
    `handler` - the mouse move handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addMouseOutHandler

    public HandlerRegistration addMouseOutHandler(MouseOutHandler handler)

  Description copied from interface: `HasMouseOutHandlers`
  Adds a `MouseOutEvent` handler.

  Specified by:
    `addMouseOutHandler` in interface `HasMouseOutHandlers`
  Parameters:
    `handler` - the mouse out handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addMouseOverHandler

    public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)

  Description copied from interface: `HasMouseOverHandlers`
  Adds a `MouseOverEvent` handler.

  Specified by:
    `addMouseOverHandler` in interface `HasMouseOverHandlers`
  Parameters:
    `handler` - the mouse over handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addMouseUpHandler

    public HandlerRegistration addMouseUpHandler(MouseUpHandler handler)

  Description copied from interface: `HasMouseUpHandlers`
  Adds a `MouseUpEvent` handler.

  Specified by:
    `addMouseUpHandler` in interface `HasMouseUpHandlers`
  Parameters:
    `handler` - the mouse up handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addMouseWheelHandler

    public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)

  Description copied from interface: `HasMouseWheelHandlers`
  Adds a `MouseWheelEvent` handler.

  Specified by:
    `addMouseWheelHandler` in interface `HasMouseWheelHandlers`
  Parameters:
    `handler` - the mouse wheel handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addMouseWheelListener

    @Deprecated
    public void addMouseWheelListener(MouseWheelListener listener)

  Deprecated. Use `addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)` instead

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

### removeClickListener

    @Deprecated
    public void removeClickListener(ClickListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `addClickHandler(com.google.gwt.event.dom.client.ClickHandler)` instead

  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

    @Deprecated
    public void removeMouseListener(MouseListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by an add*Handler method instead

  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

    @Deprecated
    public void removeMouseWheelListener(MouseWheelListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)` instead

### 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
| GWT 2.0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD