Display HTML in the GWT panel

Is there a way to display HTML in a GWT panel?

+3
source share
4 answers

Short answer: you can add HTML to the GWT panel by creating an HTML widget and linking this widget to the panel. For instance...

HorizontalPanel hp = new HorizontalPanel();
HTML html = new HTML("<p>This is html with a <a href='www.google.com'>link</a></p>");
hp.add(html); // adds the widget to the panel

Long answer: There are many ways to add HTML to the GWT panel. You should start by reading the Developer's Guide for GWT . In particular, you should read fragments on the Layout using panels and Widgets .

+11
source

In addition, the new declarative user interface material in GWT 2.0 eliminates the need to embed HTML in your Java.

<g:HTMLPanel>
   Here <strong>is some HTML</strong>.
</g:HTMLPanel>
+5

. -. , , . ,

HTML example = new HTML(someText)

, :)

+3
source
import com.google.gwt.user.client.ui.HTML;

import com.google.gwt.user.client.ui.RootPanel;

RootPanel.get().add(new HTML("<b>Gwt Html</b>"));

you can add this HTML widget to any panel with the code " panel.add(widget);"

+3
source

Source: https://habr.com/ru/post/1729065/


All Articles