Javatpoint Logo
Javatpoint Logo

GWT HTMLPanel

GWT HTMLPanel consist of HTML contents only. We can add child widgets into identified element within html content.

GWT HTMLPanel class declaration

Let's see the declaration of com.google.gwt.user.client.ui.HTMLPanel

GWT HTMLPanel Constructors

Constructor Description
HTMLPanel(SafeHtml safeHtml) It initializes the HTMLPanelanel from the SafeHtml object.
HTMLPanel(java.lang.String html) It creates the HTMLPanel with the specified HTML content inside a DIV element.
HTMLPanel(java.lang.String tag, java.lang.String html) It creates the HTMLPanel whose root element has the given tag. It also has the specified HTML content.

GWT HTMLPanel Methods

Modifier and Types Method Description
void add(Widget widget) It adds a child widget to the panel.
void add(Widget widget, Element element) It adds a widget to the panel, contained within a HTML element.
void add(Widget widget, java.lang.String id) It adds a child widget to the panel, contained within the HTML element specified by a given id.
void addAndReplaceElement(IsWidget widget, Element toReplace) It replaces the element. It is the overloaded version for IsWidget.
void addAndReplaceElement(Widget widget, Element toReplace) It adds a child widget to the panel, replacing the HTML element.
void addAndReplaceElement(Widget widget, java.lang.String id) It adds a child widget to the panel, replacing the HTML element specified by a given id.
static java.lang.String createUniqueId() A helper method for creating unique IDs for elements within dynamically- generated HTML.
Element getElementById(java.lang.String id) It finds an element within the panel by its id.
static HTMLPanel removeAllRows() It removes all rows in the table.
void wrap(Element element) It creates a HTML panel that wraps an existing element.

GWT HTMLPanel Example

//SampleHTMLPanel.java

//SampleHTMLPanel.css

Output:

GWT HtmlPanel
Next TopicGWT Form Panel





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA