JShweky
JShweky

Reputation: 139

Line break between GWT widgets

I'm trying to place two label/textbox pairs one on top of the other (like a login page). Since my background is in HTML, I tried to hack a line break like this:

HTML html = new HTML("< br />");

panel.add(firstBox);
panel.add(html);
panel.add(secondBox);

It didn't drop the next label/textbox pair to a new line. Any suggestions for either fixing this or a better overall way to position items on a panel in GWT?

Upvotes: 2

Views: 1972

Answers (2)

Minu
Minu

Reputation: 194

Try:

panel.getElement().appendChild(DOM.createElement(BRElement.TAG));

Upvotes: 2

Michael
Michael

Reputation: 33297

You can use:

FlowPanel firstBox = new FlowPanel();
panel.getElement().getStyle().setWidth(100, Unit.PCT);
FlowPanel secondBox = new FlowPanel();
panel.getElement().getStyle().setWidth(100, Unit.PCT);

Upvotes: 0

Related Questions