Class WGroupBox


public class WGroupBox extends WContainerWidget
A widget which group widgets into a frame with a title.

This is typically used in a form to group certain form elements together.

Usage example:


 enum Vote { Republican , Democrat , NoVote };

 // use a group box as widget container for 3 radio buttons, with a title
 WGroupBox container = new WGroupBox("USA elections vote");

 // use a button group to logically group the 3 options
 WButtonGroup group = new WButtonGroup(this);

 WRadioButton button;
 button = new WRadioButton("I voted Republican", container);
 new WBreak(container);
 group.addButton(button, Vote.Republican.ordinal());

 button = new WRadioButton("I voted Democrat", container);
 new WBreak(container);
 group.addButton(button, Vote.Democrate.ordinal());

 button = new WRadioButton("I didn't vote", container);
 new WBreak(container);
 group.addButton(button, Vote.NoVote.ordinal());

 group.setCheckedButton(group.button(Vote.NoVote.ordinal()));

 

Like WContainerWidget, WGroupBox is by default displayed as a block.

WGroupBox example

CSS

The widget corresponds to the HTML <fieldset> tag, and the title in a nested <legend> tag. This widget does not provide styling, and can be styled using inline or external CSS as appropriate.

  • Constructor Details

  • Method Details

    • getTitle

      public WString getTitle()
      Returns the title.
    • setTitle

      public void setTitle(CharSequence title)
      Sets the title.
    • refresh

      public void refresh()
      Description copied from class: WWidget
      Refresh the widget.

      The refresh method is invoked when the locale is changed using WApplication#setLocale() or when the user hit the refresh button.

      The widget must actualize its contents in response.

      Note: This does not rerender the widget! Calling refresh() usually does not have any effect (unless you've reimplemented refresh() to attach to it an effect).

      Overrides:
      refresh in class WWebWidget