Group box

A WGroupBox corresponds to an HTML <fieldset> element, and provides a frame and title around a group of widgets.

Example
A group box

Some contents.

More contents.

source
  void GroupBox() {
    WGroupBox groupBox = new WGroupBox("A group box");
    groupBox.addStyleClass("centered-example");
    new WText("<p>Some contents.</p>", (WContainerWidget) groupBox);
    new WText("<p>More contents.</p>", (WContainerWidget) groupBox);
  }

It is usually styled using the CSS stylesheet which provides many options for layout of the legend (title) and the box contents.

Panel

A WPanel is similar to a group box, but provides optional functionality to collapse or expand its contents, and a theme-based style.

Example
This is a default panel.
source
  void PanelNoTitle() {
    WPanel panel = new WPanel();
    panel.addStyleClass("centered-example");
    panel.setCentralWidget(new WText("This is a default panel."));
  }
Example
Terrific panel
This is a panel with a title.
source
  void Panel() {
    WPanel panel = new WPanel();
    panel.addStyleClass("centered-example");
    panel.setTitle("Terrific panel");
    panel.setCentralWidget(new WText("This is a panel with a title."));
  }
Example
Collapsible panel
This panel can be collapsed.
source
  void PanelCollapsible() {
    WPanel panel = new WPanel();
    panel.setTitle("Collapsible panel");
    panel.addStyleClass("centered-example");
    panel.setCollapsible(true);
    WAnimation animation =
        new WAnimation(AnimationEffect.SlideInFromTop, TimingFunction.EaseOut, 100);
    panel.setAnimation(animation);
    panel.setCentralWidget(new WText("This panel can be collapsed."));
  }

Top