Package javax.swing

Examples of javax.swing.ButtonGroup


        //Create Backup Panel
        //**********************************************************
        JPanel panelModules = new JPanel();
        panelModules.setLayout(Layout.getGBL());
       
        final ButtonGroup buttonGroup = new ButtonGroup();
        class SelectModuleAction implements ItemListener {
            @Override
            public void itemStateChanged(ItemEvent ev) {
                String command = buttonGroup.getSelection().getActionCommand();
                selectedModule = Integer.parseInt(command);
            }
        }        
       
        DcLongTextField textHelp = ComponentFactory.getLongTextField();
        textHelp.setBorder(null);
        JScrollPane scroller = new JScrollPane(textHelp);
        scroller.setBorder(null);
        scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
        textHelp.setEditable(false);
        textHelp.setText(help);
       
        int y = 0;
        int x = 0;
       
        for (DcModule module : modules) {
            ImageIcon icon = module.getIcon32() == null ? module.getIcon16() : module.getIcon32();
            icon = icon == null ? IconLibrary._icoModuleTypeProperty32 : icon;
            JRadioButton radioButton = ComponentFactory.getRadioButton(module.getLabel(), icon, "" + module.getIndex());
           
            radioButton.addActionListener(this);
            radioButton.addItemListener(new SelectModuleAction());
            buttonGroup.add(radioButton);
            panelModules.add(radioButton, Layout.getGBC( x, y++, 1, 1, 1.0, 1.0
                    ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                     new Insets( 0, 5, 5, 5), 0, 0));
           
            if (y == 6) {
View Full Code Here


    }
   
    private void build() {
        setLayout(Layout.getGBL());
       
        final ButtonGroup bg = new ButtonGroup();
        class ModuleSelectionListener implements MouseListener {
            @Override
            public void mouseClicked(MouseEvent e) {}
            @Override
            public void mouseEntered(MouseEvent e) {}
            @Override
            public void mouseExited(MouseEvent e) {}
            @Override
            public void mousePressed(MouseEvent e) {}

            @Override
            public void mouseReleased(MouseEvent e) {
                String command = bg.getSelection().getActionCommand();
                module = Integer.parseInt(command);
                try {
                   
                    if (getWizard().isAtTheEnd())
                        getWizard().finish();
                    else
                        getWizard().next();
                   
                } catch (WizardException wi) {
                    DcSwingUtilities.displayWarningMessage(wi.getMessage());
                }
            }
        }

        int y = 0;
        int x = 0;
       
        for (DcModule module : DcModules.getModules()) {
            if (module.isSelectableInUI() && module.isTopModule()) {
                JRadioButton rb = ComponentFactory.getRadioButton(module.getLabel(), module.getIcon32(), "" + module.getIndex());
                rb.addMouseListener(new ModuleSelectionListener());
                bg.add(rb);
               
                components.put(module.getIndex(), rb);
               
                add(rb, Layout.getGBC( x, y++, 1, 1, 1.0, 1.0
                   ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
View Full Code Here

        return module;
    }
   
    private void build() {
        final ButtonGroup buttonGroup = new ButtonGroup();

        class ModuleTypeSelectionListener implements MouseListener {
            @Override
            public void mouseClicked(MouseEvent arg0) {}
            @Override
            public void mouseEntered(MouseEvent arg0) {}
            @Override
            public void mouseExited(MouseEvent arg0) {}
            @Override
            public void mousePressed(MouseEvent arg0) {}

            @Override
            public void mouseReleased(MouseEvent arg0) {
                String command = buttonGroup.getSelection().getActionCommand();
                type = Integer.parseInt(command);
                try {
                    getWizard().next();
                } catch (WizardException wi) {
                    DcSwingUtilities.displayWarningMessage(wi.getMessage());
                }           
            }
        }         
       
        setLayout(Layout.getGBL());
       
        JRadioButton rbPlainMod = ComponentFactory.getRadioButton(
                DcResources.getText("lblPlainModule"),  IconLibrary._icoModuleTypePlain, "" + _OTHERMODULE);
        JRadioButton rbMediaMod = ComponentFactory.getRadioButton(
                DcResources.getText("lblMediaModule"),  IconLibrary._icoModuleTypeMedia, "" + _MEDIAMODULE);
        JRadioButton rbPropertyMod = ComponentFactory.getRadioButton(
                DcResources.getText("lblPropertyModule"), IconLibrary._icoModuleTypeProperty32, "" + _PROPERTYMODULE);
        JRadioButton rbAssociateMod = ComponentFactory.getRadioButton(
                DcResources.getText("lblAssociateModule"), IconLibrary._icoModuleTypeAssociate, "" + _ASSOCIATEMODULE);
       
        rbPlainMod.addMouseListener(new ModuleTypeSelectionListener());
        rbMediaMod.addMouseListener(new ModuleTypeSelectionListener());
        rbPropertyMod.addMouseListener(new ModuleTypeSelectionListener());
        rbAssociateMod.addMouseListener(new ModuleTypeSelectionListener());
       
        buttonGroup.add(rbPlainMod);
        buttonGroup.add(rbMediaMod);
        buttonGroup.add(rbPropertyMod);
        buttonGroup.add(rbAssociateMod);

        add(rbPropertyMod,Layout.getGBC(0, 0, 1, 1, 1.0, 1.0
                ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                 new Insets( 0, 5, 5, 5), 0, 0));       
        add(rbMediaMod, Layout.getGBC(0, 1, 1, 1, 1.0, 1.0
View Full Code Here

  private ButtonGroup bg;
  private Collection<ItemImporter> readers = new ArrayList<ItemImporter>();
 
    public ItemImporterSelectionPanel(ItemImporterWizard wizard) {
      this.wizard = wizard;
      this.bg = new ButtonGroup();
     
      build();
    }
View Full Code Here

    }
   
    private void build() {
        setLayout(Layout.getGBL());
       
        final ButtonGroup bg = new ButtonGroup();
        class ModuleSelectionListener implements MouseListener {
            @Override
            public void mouseClicked(MouseEvent e) {}
            @Override
            public void mouseEntered(MouseEvent e) {}
            @Override
            public void mouseExited(MouseEvent e) {}
            @Override
            public void mousePressed(MouseEvent e) {}

            @Override
            public void mouseReleased(MouseEvent e) {
                String command = bg.getSelection().getActionCommand();
                selectedModule = Integer.parseInt(command);
                try {
                   
                    if (getWizard().isAtTheEnd())
                        getWizard().finish();
                    else
                        getWizard().next();
                   
                } catch (WizardException wi) {
                    DcSwingUtilities.displayWarningMessage(wi.getMessage());
                }
            }
        }

        int y = 0;
        int x = 0;
       
        for (DcModule module : getModules()) {
            if (isModuleAllowed(module)) {
                JRadioButton rb = ComponentFactory.getRadioButton(module.getLabel(), module.getIcon16(), "" + module.getIndex());
                rb.addMouseListener(new ModuleSelectionListener());
                bg.add(rb);
               
                components.put(module.getIndex(), rb);
               
                add(rb, Layout.getGBC( x, y++, 1, 1, 1.0, 1.0
                   ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
View Full Code Here

    public void destroy() {}
   
    private void build() {
        setLayout(Layout.getGBL());
       
        final ButtonGroup bg = new ButtonGroup();
        class ModuleSelectionListener implements ItemListener {
            @Override
            public void itemStateChanged(ItemEvent ev) {
                String command = bg.getSelection().getActionCommand();
                selectedModule = Integer.parseInt(command);
                try {
                    getWizard().next();
                } catch (WizardException wi) {
                    DcSwingUtilities.displayMessage(wi.getMessage());
                }
            }
        }

        int y = 0;
        int x = 0;
       
        for (DcModule module : DcModules.getAllModules()) {
           
            if ( module.isTopModule() &&
                !module.isAbstract() &&
                !module.isParentModule() && !module.isChildModule()) {
               
                JRadioButton rb = ComponentFactory.getRadioButton(
                        module.getName(), module.getIcon16(), "" + module.getIndex());

                rb.addItemListener(new ModuleSelectionListener());
                bg.add(rb);
                add(rb, Layout.getGBC( x, y++, 1, 1, 1.0, 1.0
                   ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
                    new Insets( 0, 5, 5, 5), 0, 0));
               
               
View Full Code Here

        rbOriginalLoc.addActionListener(this);
        rbAlternateLoc.addActionListener(this);
        rbOriginalLoc.setActionCommand("useOriginalLocation");
        rbAlternateLoc.setActionCommand("useAlternateLocation");
       
        ButtonGroup bg = new ButtonGroup();
        bg.add(rbOriginalLoc);
        bg.add(rbAlternateLoc);
       
        rbOriginalLoc.setSelected(true);
       
        panelConfig.add(rbOriginalLoc, Layout.getGBC(0, 0, 1, 1, 1.0, 1.0
                ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
View Full Code Here

    }    
   
    private void build() {
        setLayout(Layout.getGBL());
       
        final ButtonGroup bg = new ButtonGroup();
        class ModuleSelectionListener implements ItemListener {
            @Override
            public void itemStateChanged(ItemEvent ev) {
                String command = bg.getSelection().getActionCommand();
                selectedModule = Integer.parseInt(command);
                try {
                    getWizard().finish();
                } catch (WizardException wi) {
                    DcSwingUtilities.displayWarningMessage(wi.getMessage());
                }
            }
        }

        int y = 0;
        int x = 0;
       
        for (DcModule module : DcModules.getAllModules()) {
           
            if (!module.isAbstract() &&
                 module.isTopModule() &&
                !module.isParentModule() && !module.isChildModule()) {

                JRadioButton rb = ComponentFactory.getRadioButton(
                        module.getName(), module.getIcon16(), "" + module.getIndex());

                fields.put(module.getIndex(), rb);
               
                rb.addItemListener(new ModuleSelectionListener());
                bg.add(rb);
                add(rb, Layout.getGBC( x, y++, 1, 1, 1.0, 1.0
                   ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
                    new Insets( 0, 5, 5, 5), 0, 0));
               
                if (y == 7) {
View Full Code Here

            Box subbox1 = Box.createHorizontalBox();
            Box subbox3 = Box.createHorizontalBox();

            // The DTED Level selector
            JPanel levelPanel = PaletteHelper.createPaletteJPanel("DTED Level");
            ButtonGroup levels = new ButtonGroup();

            ActionListener al = new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (cache != null) {
                        String ac = e.getActionCommand();
                        int newLevel;
                        if (ac.equalsIgnoreCase(level2Command))
                            newLevel = LEVEL_2;
                        else if (ac.equalsIgnoreCase(level1Command))
                            newLevel = LEVEL_1;
                        else
                            newLevel = LEVEL_0;
                        setDtedLevel(newLevel);
                    }
                }
            };

            JRadioButton level0 = new JRadioButton("Level 0");
            level0.addActionListener(al);
            level0.setActionCommand(level0Command);
            JRadioButton level1 = new JRadioButton("Level 1");
            level1.addActionListener(al);
            level1.setActionCommand(level1Command);
            JRadioButton level2 = new JRadioButton("Level 2");
            level2.addActionListener(al);
            level2.setActionCommand(level2Command);

            levels.add(level0);
            levels.add(level1);
            levels.add(level2);

            switch (getDtedLevel()) {
            case 2:
                level2.setSelected(true);
                break;
View Full Code Here

            //          palette = new JPanel();
            //          palette.setLayout(new GridLayout(0, 1));

            // The DTED Level selector
            JPanel levelPanel = PaletteHelper.createPaletteJPanel("DTED Level");
            ButtonGroup levels = new ButtonGroup();

            ActionListener al = new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (cache != null) {
                        String ac = e.getActionCommand();
                        int newLevel;
                        if (ac.equalsIgnoreCase(level2Command))
                            newLevel = DTEDFrameSubframe.LEVEL_2;
                        else if (ac.equalsIgnoreCase(level1Command))
                            newLevel = DTEDFrameSubframe.LEVEL_1;
                        else
                            newLevel = DTEDFrameSubframe.LEVEL_0;
                        DTEDFrameSubframeInfo dfsi = cache.getSubframeInfo();
                        dfsi.dtedLevel = newLevel;
                        //                      cache.setSubframeInfo(dfsi);
                    }
                }
            };

            JRadioButton level0 = new JRadioButton("Level 0");
            level0.addActionListener(al);
            level0.setActionCommand(level0Command);
            JRadioButton level1 = new JRadioButton("Level 1");
            level1.addActionListener(al);
            level1.setActionCommand(level1Command);
            JRadioButton level2 = new JRadioButton("Level 2");
            level2.addActionListener(al);
            level2.setActionCommand(level2Command);

            levels.add(level0);
            levels.add(level1);
            levels.add(level2);

            switch (dtedLevel) {
            case 2:
                level2.setSelected(true);
                break;
View Full Code Here

TOP

Related Classes of javax.swing.ButtonGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.