Roughian Examples Site Map - GWT Examples - Tutorials

CaptionPanel


Version 1.5 onwards

Wraps A Widget And Adds A Title



Notes


Quite a useful thing, much used in desktop apps for grouping elements of a similar nature - radio button sets, grouping input (address lines etc)

There is no associated style (eg gwt-CaptionPanel) at the time of writing.


Code

CaptionPanel panel = new CaptionPanel("Caption Goes Here");
RootPanelUncached.get("demo").add(panel);

panel.setContentWidget(new Label("The main, wrapped widget goes here."));

// Set up some style - normally you'd do this in CSS, but it's
// easier to show like this

DOM.setStyleAttribute(panel.getElement(),
     "border", "3px solid #00c");
DOM.setStyleAttribute(panel.getContentWidget().getElement(),
     "margin", "5px 10px 10px 10px");
DOM.setStyleAttribute(panel.getContentWidget().getElement(),
     "padding", "10px 10px 10px 10px");
DOM.setStyleAttribute(panel.getContentWidget().getElement(),
     "border", "1px solid #ccf");