Announcement Announcement Module
Collapse
No announcement yet.
Menu with ButtonGroup Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Menu with ButtonGroup

    Hello,
    I want create menu with a few JCheckBox members and only one selected (like ButtonGroup do)
    How I can do it with TargetableActionCommand (menu have another item, too) ?


    regards

  • #2
    Snpe,

    Take a look at an example of this in the application.setup license wizard support--the class is SetupLicenseWizardPage. In it, it creates an exclusive command group and generates radio buttons for the accept / do not accept commands. You can apply a siimiliar approach, only generate check boxes instead of radio buttons:

    Code:
        protected JComponent createControl() {
            ...
    
            ToggleCommand acceptCommand = new ToggleCommand("acceptLicenseCommand") {
                protected void onSelection() {
                    SetupLicenseWizardPage.this.setEnabled(true);
                }
            };
    
            ToggleCommand doNotAcceptCommand = new ToggleCommand("doNotAcceptLicenseCommand") {
                protected void onSelection() {
                    SetupLicenseWizardPage.this.setEnabled(false);
                }
            };
            doNotAcceptCommand.setSelected(true);
    
            CommandGroup.createExclusiveCommandGroup(new ToggleCommand[] { acceptCommand, doNotAcceptCommand });
    
            GridBagLayoutBuilder formBuilder = new GridBagLayoutBuilder();
            formBuilder.append(new JScrollPane(licenseTextPane), 1, 1, true, true);
            formBuilder.nextLine();
            // can say createCheckBox instead...
            formBuilder.append(acceptCommand.createRadioButton());
            formBuilder.nextLine();
            formBuilder.append(doNotAcceptCommand.createRadioButton());
            return formBuilder.getPanel();
        }
    Keith

    Comment


    • #3
      It work fine.Thanks

      Comment

      Working...
      X