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 HTML

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

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

    public class HTML

extends Label
implements HasHTML

A widget that can contain arbitrary HTML.

If you only need a simple label (text, but not HTML), then the `Label` widget is more appropriate, as it disallows the use of HTML, which can lead to potential security issues if not used properly.

### CSS Style Rules

- .gwt-HTML { }

### 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 interface 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
`HTML()` Creates an empty HTML widget.
`HTML(java.lang.String html)` Creates an HTML widget with the specified HTML contents.
`HTML(java.lang.String html, boolean wordWrap)` Creates an HTML widget with the specified contents, optionally treating it as HTML, and optionally disabling word wrapping.

Method Summary
`java.lang.String` | `getHTML()` Gets this object's contents as HTML.
`void` | `setHTML(java.lang.String html)` Sets this object's contents via HTML.

Methods inherited from class com.google.gwt.user.client.ui.Label
`addClickListener, addMouseListener, addMouseWheelListener, getHorizontalAlignment, getText, getWordWrap, onBrowserEvent, removeClickListener, removeMouseListener, removeMouseWheelListener, setHorizontalAlignment, setText, setWordWrap`

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

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

Methods inherited from interface com.google.gwt.user.client.ui.HasText
`getText, setText`

Constructor Detail

### HTML

    public HTML()

  Creates an empty HTML widget.

### HTML

    public HTML(java.lang.String html)

  Creates an HTML widget with the specified HTML contents.

  Parameters:
    `html` - the new widget's HTML contents

### HTML

    public HTML(java.lang.String html,
                boolean wordWrap)

  Creates an HTML widget with the specified contents, optionally treating it as HTML, and optionally disabling word wrapping.

  Parameters:
    `html` - the widget's contents
    `wordWrap` - `false` to disable word wrapping

Method Detail

### getHTML

    public java.lang.String getHTML()

  Description copied from interface: `HasHTML`
  Gets this object's contents as HTML.

  Specified by:
    `getHTML` in interface `HasHTML`
  Returns:
    the object's HTML

### setHTML

    public void setHTML(java.lang.String html)

  Description copied from interface: `HasHTML`
  Sets this object's contents via HTML. Use care when setting an object's HTML; it is an easy way to expose script-based security problems. Consider using `HasText.setText(String)` whenever possible.

  Specified by:
    `setHTML` in interface `HasHTML`
  Parameters:
    `html` - the object's new HTML

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