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

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.Widget
          extended bycom.google.gwt.user.client.ui.Label
All Implemented Interfaces:
EventListener, HasHorizontalAlignment, HasText, HasWordWrap, SourcesClickEvents, SourcesMouseEvents
Direct Known Subclasses:
HTML

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

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

CSS Style Rules

Example

code


Nested Class Summary
 
Nested classes inherited from class com.google.gwt.user.client.ui.HasHorizontalAlignment
HasHorizontalAlignment.HorizontalAlignmentConstant
 
Field Summary
 
Fields inherited from class java.lang.Object
typeId, typeName
 
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(String text)
          Creates a label with the specified text.
Label(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.
 HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
          Gets the horizontal alignment.
 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 setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
          Sets the horizontal alignment.
 void setText(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
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, finalize, hashCode
 

Constructor Detail

Label

public Label()
Creates an empty label.


Label

public Label(String text)
Creates a label with the specified text.

Parameters:
text - the new label's text

Label

public Label(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

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

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(String text)
Description copied from interface: HasText
Sets this object's text.

Specified by:
setText in interface HasText

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.


This javadoc distribution was not produced by Google. The official documentation is here.