Search in sources :

Example 31 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project jsql-injection by ron190.

the class ManagerDatabase method initErrorMethods.

public void initErrorMethods(Vendor vendor) {
    this.itemRadioStrategyError[0].removeAll();
    Integer[] i = { 0 };
    if (vendor != Vendor.AUTO && vendor.instance().getXmlModel().getStrategy().getError() != null) {
        for (Method methodError : vendor.instance().getXmlModel().getStrategy().getError().getMethod()) {
            JMenuItem itemRadioVendor = new JRadioButtonMenuItem(methodError.getName());
            itemRadioVendor.setEnabled(false);
            this.itemRadioStrategyError[0].add(itemRadioVendor);
            this.groupStrategy.add(itemRadioVendor);
            final int indexError = i[0];
            itemRadioVendor.addActionListener(actionEvent -> {
                ManagerDatabase.this.menuStrategy.setText(methodError.getName());
                MediatorModel.model().setStrategy(StrategyInjection.ERROR);
                ((StrategyInjectionError) StrategyInjection.ERROR.instance()).setIndexMethod(indexError);
            });
            i[0]++;
        }
    }
}
Also used : StrategyInjectionError(com.jsql.model.injection.strategy.StrategyInjectionError) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Method(com.jsql.model.injection.vendor.model.Model.Strategy.Error.Method) JMenuItem(javax.swing.JMenuItem)

Example 32 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project energy3d by concord-consortium.

the class MainFrame method createRoofTextureMenuItem.

JRadioButtonMenuItem createRoofTextureMenuItem(final int type, final String imageFile) {
    final JRadioButtonMenuItem m = new JRadioButtonMenuItem(new ImageIcon(MainPanel.class.getResource(imageFile)));
    m.setText("Texture #" + (type + 1));
    m.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                final ChangeRoofTextureCommand c = new ChangeRoofTextureCommand();
                Scene.getInstance().setTextureMode(TextureMode.Full);
                Scene.getInstance().setRoofTextureType(type);
                Scene.getInstance().setEdited(true);
                if (MainPanel.getInstance().getEnergyButton().isSelected()) {
                    MainPanel.getInstance().getEnergyButton().setSelected(false);
                }
                SceneManager.getInstance().getUndoManager().addEdit(c);
            }
        }
    });
    return m;
}
Also used : ChangeRoofTextureCommand(org.concord.energy3d.undo.ChangeRoofTextureCommand) ImageIcon(javax.swing.ImageIcon) ItemEvent(java.awt.event.ItemEvent) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) ItemListener(java.awt.event.ItemListener)

Example 33 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project energy3d by concord-consortium.

the class MainFrame method getForestMenuItem.

private JRadioButtonMenuItem getForestMenuItem() {
    if (forestMenuItem == null) {
        forestMenuItem = new JRadioButtonMenuItem("Forest");
        forestMenuItem.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(final ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                    final ChangeThemeCommand c = new ChangeThemeCommand();
                    Scene.getInstance().setTheme(Scene.FOREST_THEME);
                    Scene.getInstance().setEdited(true);
                    SceneManager.getInstance().getUndoManager().addEdit(c);
                }
            }
        });
        themeButtonGroup.add(forestMenuItem);
    }
    return forestMenuItem;
}
Also used : ItemEvent(java.awt.event.ItemEvent) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) ItemListener(java.awt.event.ItemListener) ChangeThemeCommand(org.concord.energy3d.undo.ChangeThemeCommand)

Example 34 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project energy3d by concord-consortium.

the class MainFrame method getBlueSkyMenuItem.

private JRadioButtonMenuItem getBlueSkyMenuItem() {
    if (blueSkyMenuItem == null) {
        blueSkyMenuItem = new JRadioButtonMenuItem("Blue Sky");
        blueSkyMenuItem.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(final ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                    final ChangeThemeCommand c = new ChangeThemeCommand();
                    Scene.getInstance().setTheme(Scene.BLUE_SKY_THEME);
                    Scene.getInstance().setEdited(true);
                    SceneManager.getInstance().getUndoManager().addEdit(c);
                }
            }
        });
        themeButtonGroup.add(blueSkyMenuItem);
    }
    return blueSkyMenuItem;
}
Also used : ItemEvent(java.awt.event.ItemEvent) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) ItemListener(java.awt.event.ItemListener) ChangeThemeCommand(org.concord.energy3d.undo.ChangeThemeCommand)

Example 35 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project energy3d by concord-consortium.

the class MainFrame method getExactSizeRadioButtonMenuItem.

private JRadioButtonMenuItem getExactSizeRadioButtonMenuItem() {
    if (exactSizeRadioButtonMenuItem == null) {
        exactSizeRadioButtonMenuItem = new JRadioButtonMenuItem("Exact Size On Paper");
        exactSizeRadioButtonMenuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(final ActionEvent e) {
                PrintController.getInstance().setScaleToFit(false);
            }
        });
        printSizeOptionBbuttonGroup.add(exactSizeRadioButtonMenuItem);
    }
    return exactSizeRadioButtonMenuItem;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem)

Aggregations

JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)109 ButtonGroup (javax.swing.ButtonGroup)57 JMenu (javax.swing.JMenu)57 ActionEvent (java.awt.event.ActionEvent)55 ActionListener (java.awt.event.ActionListener)48 JMenuItem (javax.swing.JMenuItem)44 ItemEvent (java.awt.event.ItemEvent)24 ItemListener (java.awt.event.ItemListener)24 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)19 JPopupMenu (javax.swing.JPopupMenu)14 JPanel (javax.swing.JPanel)13 BorderLayout (java.awt.BorderLayout)12 JLabel (javax.swing.JLabel)12 JTextField (javax.swing.JTextField)12 JOptionPane (javax.swing.JOptionPane)10 MenuEvent (javax.swing.event.MenuEvent)10 MenuListener (javax.swing.event.MenuListener)10 JRadioButton (javax.swing.JRadioButton)9 HousePart (org.concord.energy3d.model.HousePart)9 AbstractAction (javax.swing.AbstractAction)8