GWT GroupBox panel widget
I needed for my GWT project a panel that supports showing a set of widgets in a group (GroupBox panle). I needed the exact functionality like the HTML fieldset/legend tags:
I didn’t found any ready-to-use widget so I implemented one myself. Here is the source code:
import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.FlowPanel; public class GroupBoxPanel extends FlowPanel { private Element legend; public GroupBoxPanel() { Element fieldset = DOM.createFieldSet(); this.legend = DOM.createLegend(); DOM.appendChild(fieldset, legend); setElement(fieldset); } public String getCaption() { return DOM.getInnerText(this.legend); } public void setCaption(String caption) { DOM.setInnerText(this.legend, caption); } }
It was really easy to extend the flow panel and add <fieldset> and <legend> tags around the panel element. Hope this widget will be useful to everybody. I may wish to modify the CSS to make it look better.
3 Responses to “GWT GroupBox panel widget”
thank you very much , I’m newer for java
and i would like to khown about ul li tag in gwt;
please write some article for me
thank you
it have error “AssertionError: Element may only be set once” how to result this problem?
This widget is too old and is not supported. I think something has been changed in GWT and now it might not work well. You can use the Ext-GWT library: http://code.google.com/p/gwt-ext/