Example usage for javax.swing ButtonGroup add

List of usage examples for javax.swing ButtonGroup add

Introduction

In this page you can find the example usage for javax.swing ButtonGroup add.

Prototype

public void add(AbstractButton b) 

Source Link

Document

Adds the button to the group.

Usage

From source file:org.languagetool.gui.Main.java

private void addLookAndFeelMenuItem(JMenu lafMenu, UIManager.LookAndFeelInfo laf, ButtonGroup buttonGroup) {
    JRadioButtonMenuItem lfItem = new JRadioButtonMenuItem(new SelectLFAction(laf));
    lafMenu.add(lfItem);//from w  w w.j a  v  a  2 s.co  m
    buttonGroup.add(lfItem);
    if (laf.getClassName().equals(UIManager.getLookAndFeel().getClass().getName())) {
        buttonGroup.setSelected(lfItem.getModel(), true);
    }
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createLanguagePanel(int stentWidth) {
    // Language radios.
    MultiBitTitledPanel languagePanel = new MultiBitTitledPanel(
            controller.getLocaliser().getString("showPreferencesPanel.languageTitle"),
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;//from w w  w  .ja v  a 2  s.co m
    constraints.gridy = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 0.05;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel indent = MultiBitTitledPanel.getIndentPanel(1);
    languagePanel.add(indent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel stent = MultiBitTitledPanel.createStent(stentWidth);
    languagePanel.add(stent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.weightx = 0.05;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.CENTER;
    languagePanel.add(MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS),
            constraints);

    ButtonGroup languageUsageGroup = new ButtonGroup();
    useDefaultLocale = new JRadioButton(controller.getLocaliser().getString("showPreferencesPanel.useDefault"));
    useDefaultLocale.setOpaque(false);
    useDefaultLocale.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    JRadioButton useSpecific = new JRadioButton(
            controller.getLocaliser().getString("showPreferencesPanel.useSpecific"));
    useSpecific.setOpaque(false);
    useSpecific.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    ItemListener itemListener = new ChangeLanguageUsageListener();
    useDefaultLocale.addItemListener(itemListener);
    useSpecific.addItemListener(itemListener);
    languageUsageGroup.add(useDefaultLocale);
    languageUsageGroup.add(useSpecific);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    languagePanel.add(useDefaultLocale, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    languagePanel.add(useSpecific, constraints);

    // Language combo box.
    int numberOfLanguages = Integer
            .parseInt(controller.getLocaliser().getString("showPreferencesPanel.numberOfLanguages"));

    // Languages are added to the combo box in alphabetic order.
    languageDataSet = new TreeSet<LanguageData>();

    for (int i = 0; i < numberOfLanguages; i++) {
        String languageCode = controller.getLocaliser()
                .getString("showPreferencesPanel.languageCode." + (i + 1));
        String language = controller.getLocaliser().getString("showPreferencesPanel.language." + (i + 1));

        LanguageData languageData = new LanguageData();
        languageData.languageCode = languageCode;
        languageData.language = language;
        languageData.image = createImageIcon(languageCode);
        languageData.image.setDescription(language);
        languageDataSet.add(languageData);
    }

    Integer[] indexArray = new Integer[languageDataSet.size()];
    int index = 0;
    for (@SuppressWarnings("unused")
    LanguageData languageData : languageDataSet) {
        indexArray[index] = index;
        index++;
    }
    languageComboBox = new JComboBox(indexArray);
    languageComboBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    languageComboBox.setOpaque(false);
    LanguageComboBoxRenderer renderer = new LanguageComboBoxRenderer();

    FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont());
    Dimension preferredSize = new Dimension(fontMetrics.stringWidth(A_LONG_LANGUAGE_NAME)
            + LANGUAGE_COMBO_WIDTH_DELTA + LANGUAGE_CODE_IMAGE_WIDTH,
            fontMetrics.getHeight() + COMBO_HEIGHT_DELTA);
    renderer.setPreferredSize(preferredSize);

    languageComboBox.setRenderer(renderer);

    // Get the languageCode value stored in the model.
    String userLanguageCode = controller.getModel().getUserPreference(CoreModel.USER_LANGUAGE_CODE);
    if (userLanguageCode == null || CoreModel.USER_LANGUAGE_IS_DEFAULT.equals(userLanguageCode)) {
        useDefaultLocale.setSelected(true);
        languageComboBox.setEnabled(false);
    } else {
        useSpecific.setSelected(true);
        int startingIndex = 0;
        Integer languageCodeIndex = 0;
        for (LanguageData languageData : languageDataSet) {
            if (languageData.languageCode.equals(userLanguageCode)) {
                languageCodeIndex = startingIndex;
                break;
            }
            startingIndex++;
        }
        if (languageCodeIndex != 0) {
            languageComboBox.setSelectedItem(languageCodeIndex);
            languageComboBox.setEnabled(true);
        }
    }

    // Store original value for use by submit action.
    originalUserLanguageCode = userLanguageCode;

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 6;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    languagePanel.add(languageComboBox, constraints);

    JPanel fill1 = new JPanel();
    fill1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 4;
    constraints.gridy = 6;
    constraints.weightx = 20;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    languagePanel.add(fill1, constraints);

    return languagePanel;
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createBrowserIntegrationPanel(int stentWidth) {
    MultiBitTitledPanel browserIntegrationPanel = new MultiBitTitledPanel(
            controller.getLocaliser().getString("showPreferencesPanel.browserIntegrationTitle"),
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    GridBagConstraints constraints = new GridBagConstraints();

    MultiBitTitledPanel.addLeftJustifiedTextAtIndent(
            controller.getLocaliser().getString("showPreferencesPanel.browserIntegration.messageText"), 3,
            browserIntegrationPanel);/*from w  ww . j  a  v a 2 s  .  c  o  m*/

    ButtonGroup browserIntegrationGroup = new ButtonGroup();
    ignoreAll = new JRadioButton(controller.getLocaliser().getString("showPreferencesPanel.ignoreAll"));
    ignoreAll.setOpaque(false);
    ignoreAll.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    fillAutomatically = new JRadioButton(
            controller.getLocaliser().getString("showPreferencesPanel.fillAutomatically"));
    fillAutomatically.setOpaque(false);
    fillAutomatically.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    askEveryTime = new JRadioButton(controller.getLocaliser().getString("showPreferencesPanel.askEveryTime"));
    askEveryTime.setOpaque(false);
    askEveryTime.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    browserIntegrationGroup.add(ignoreAll);
    browserIntegrationGroup.add(fillAutomatically);
    browserIntegrationGroup.add(askEveryTime);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    browserIntegrationPanel.add(ignoreAll, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 6;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.anchor = GridBagConstraints.LINE_START;
    browserIntegrationPanel.add(fillAutomatically, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 7;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.anchor = GridBagConstraints.LINE_START;
    browserIntegrationPanel.add(askEveryTime, constraints);

    return browserIntegrationPanel;
}

From source file:org.notebook.gui.widget.LookAndFeelSelector.java

protected JMenu createMenu() {
    JMenu toolMenu = new JMenu(MenuToolbar.i18n("Views"));
    ButtonGroup group = new ButtonGroup();
    JRadioButtonMenuItem item = null;
    for (String n : getListOfSkins()) {
        item = new JRadioButtonMenuItem(new LafMenuAction(n));
        if (n.equals(DEFAULT_SKIN)) {
            item.setSelected(true);//w  w  w  . j a  v  a 2 s  .  com
        }
        group.add(item);
        toolMenu.add(item);
    }

    return toolMenu;
}

From source file:org.nuclos.client.ui.collect.component.AbstractCollectableComponent.java

/**
 * @return//from w  ww  .j  a  v a  2  s . com
 * @precondition hasComparisonOperator()
 */
public JPopupMenu newComparisonOperatorPopupMenu() {
    if (!hasComparisonOperator()) {
        throw new IllegalStateException();
    }
    final JPopupMenu result = new JPopupMenu(
            getSpringLocaleDelegate().getMessage("AbstractCollectableComponent.16", "Vergleichsoperator"));

    // 1. comparison operators:
    final ButtonGroup btngrpComparisonOperators = new ButtonGroup();

    final ItemListener itemlistener = new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent ev) {
            if (ev.getStateChange() == ItemEvent.SELECTED) {
                final String sOperatorName = ((AbstractButton) ev.getItem()).getActionCommand();
                setComparisonOperator(ComparisonOperator.getInstance(sOperatorName));
                runLocked(new Runnable() {
                    @Override
                    public void run() {
                        updateSearchConditionInModel();
                    }
                });
            }
        }
    };

    ComparisonOperator[] supportedComparisonOperators = getSupportedComparisonOperators();
    if (supportedComparisonOperators == null)
        return null;

    for (ComparisonOperator compop : supportedComparisonOperators) {
        JMenuItem mi = new JRadioButtonMenuItem(
                getSpringLocaleDelegate().getMessage(compop.getResourceIdForLabel(), null));
        mi.setActionCommand(compop.name());
        mi.setToolTipText(getSpringLocaleDelegate().getMessage(compop.getResourceIdForDescription(), null));
        result.add(mi);
        btngrpComparisonOperators.add(mi);
        mi.addItemListener(itemlistener);
    }

    result.addPopupMenuListener(new PopupMenuListener() {
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent ev) {
            for (int i = 0, n = result.getComponentCount(); i < n; i++) {
                Component c = result.getComponent(i);
                if (c instanceof JMenuItem && StringUtils.emptyIfNull(((JMenuItem) c).getActionCommand())
                        .equals(getComparisonOperator().name()))
                    ((JMenuItem) c).setSelected(true);
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent ev) {
        }
    });

    // 2. right operand (value or other field):
    if (canDisplayComparisonWithOtherField()) {
        addRightOperandToPopupMenu(result, this);
    }

    return result;
}

From source file:org.nuclos.client.ui.collect.component.AbstractCollectableComponent.java

/**
 * @param result//  w  w w .j av  a 2s  .co  m
 * @param clctcomp
 */
private static void addRightOperandToPopupMenu(JPopupMenu result, final AbstractCollectableComponent clctcomp) {
    result.addSeparator();
    final ButtonGroup btngrpCompareWith = new ButtonGroup();
    final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance();

    final JRadioButtonMenuItem miValue = new JRadioButtonMenuItem(
            localeDelegate.getMessage("AbstractCollectableComponent.17", "Wertvergleich"));
    miValue.setToolTipText(localeDelegate.getMessage("AbstractCollectableComponent.10",
            "Dieses Feld mit einem festen Wert vergleichen"));
    result.add(miValue);
    btngrpCompareWith.add(miValue);
    miValue.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ev) {
            clctcomp.resetWithComparison();
            clctcomp.runLocked(new Runnable() {
                @Override
                public void run() {
                    clctcomp.updateSearchConditionInModel();
                }
            });
        }
    });

    final JRadioButtonMenuItem miOtherField = new JRadioButtonMenuItem(
            localeDelegate.getMessage("AbstractCollectableComponent.12", "Feldvergleich..."));
    miOtherField.setToolTipText(localeDelegate.getMessage("AbstractCollectableComponent.9",
            "Dieses Feld mit dem Inhalt eines anderen Felds vergleichen"));
    result.add(miOtherField);
    btngrpCompareWith.add(miOtherField);
    miOtherField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ev) {
            assert clctcomp.clcte != null;

            // select entity field with the same data type:
            final List<CollectableEntityField> lstclctefFiltered = CollectionUtils.select(
                    CollectableUtils.getCollectableEntityFields(clctcomp.clcte),
                    new Predicate<CollectableEntityField>() {
                        @Override
                        public boolean evaluate(CollectableEntityField clctef) {
                            return clctef.getJavaClass() == clctcomp.clctef.getJavaClass();
                        }
                    });
            // and sort by label:
            final List<CollectableEntityField> lstclctefSorted = CollectionUtils.sorted(lstclctefFiltered,
                    new CollectableEntityField.LabelComparator());

            final JComboBox cmbbx = new JComboBox(lstclctefSorted.toArray());
            cmbbx.setSelectedItem(clctcomp.getComparisonOtherField());

            final int iBtn = JOptionPane
                    .showConfirmDialog(clctcomp.getJComponent(),
                            new Object[] { localeDelegate.getMessage("AbstractCollectableComponent.6",
                                    "Anderes Feld: "), cmbbx },
                            localeDelegate.getMessage("AbstractCollectableComponent.15",
                                    "Vergleich mit anderem Feld"),
                            JOptionPane.OK_CANCEL_OPTION);

            if (iBtn == JOptionPane.OK_OPTION) {
                clctcomp.setWithComparison((CollectableEntityField) cmbbx.getSelectedItem());
                if (clctcomp.getComparisonOtherField() != null) {
                    // clear the view:
                    clctcomp.updateView(CollectableUtils.getNullField(clctcomp.getEntityField()));

                    if (clctcomp.compop.getOperandCount() < 2) {
                        // If the user selects "other field" and forgot to set the operator, we assume "EQUAL":
                        clctcomp.compop = ComparisonOperator.EQUAL;
                    }
                }
                clctcomp.runLocked(new Runnable() {
                    @Override
                    public void run() {
                        clctcomp.updateSearchConditionInModel();
                    }
                });
            }
        }
    });

    final List<ComparisonParameter> compatibleParameters = ComparisonParameter
            .getCompatibleParameters(clctcomp.getEntityField());
    final JRadioButtonMenuItem miParameterField = new JRadioButtonMenuItem(
            localeDelegate.getMessage("AbstractCollectableComponent.18", null));
    miParameterField.setToolTipText(localeDelegate.getMessage("AbstractCollectableComponent.19", null));
    btngrpCompareWith.add(miParameterField);
    if (compatibleParameters.size() > 0) {
        result.add(miParameterField);
        miParameterField.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ev) {
                ResourceIdMapper<ComparisonParameter> mapper = new ResourceIdMapper<ComparisonParameter>(
                        compatibleParameters);
                JComboBox cmbbx = new JComboBox(CollectionUtils.sorted(compatibleParameters, mapper).toArray());
                cmbbx.setRenderer(new DefaultListRenderer(mapper));
                cmbbx.setSelectedItem(clctcomp.getComparisonParameter());

                final int opt = JOptionPane.showConfirmDialog(clctcomp.getJComponent(),
                        new Object[] { localeDelegate.getMessage("AbstractCollectableComponent.20", null),
                                cmbbx },
                        localeDelegate.getMessage("AbstractCollectableComponent.19", null),
                        JOptionPane.OK_CANCEL_OPTION);

                if (opt == JOptionPane.OK_OPTION) {
                    clctcomp.setWithComparison((ComparisonParameter) cmbbx.getSelectedItem());
                    if (clctcomp.getComparisonParameter() != null) {
                        clctcomp.updateView(CollectableUtils.getNullField(clctcomp.getEntityField()));
                        if (clctcomp.compop.getOperandCount() < 2) {
                            clctcomp.compop = ComparisonOperator.EQUAL;
                        }
                    }
                    clctcomp.runLocked(new Runnable() {
                        @Override
                        public void run() {
                            clctcomp.updateSearchConditionInModel();
                        }
                    });
                }
            }
        });
    }

    result.addPopupMenuListener(new PopupMenuListener() {
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent ev) {
            if (clctcomp.getComparisonParameter() != null) {
                miParameterField.setSelected(true);
            } else if (clctcomp.getComparisonOtherField() == null
                    || clctcomp.getComparisonOperator().getOperandCount() < 2) {
                miValue.setSelected(true);
            } else {
                miOtherField.setSelected(true);
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent ev) {
        }
    });
}

From source file:org.nuclos.client.ui.DateTimeSeries.java

/**
 * - creates the panels//from  ww  w  .  java  2 s  .  c om
 * - set properties and actionlisteners to all controls
 * - add all controls to the panels
 */
private synchronized void setupControl() {
    this.setLayout(new BorderLayout());

    final double[] columns = new double[] { 2.0, TableLayout.PREFERRED, TableLayout.PREFERRED,
            TableLayout.PREFERRED, 2.0 };
    final double[] rows = new double[] { 4.0, 28.0, 28.0, 28.0, 28.0, 28.0, 4.0 };

    tfTimeH.setInputVerifier(new TextFieldNumberVerifier(0, 23));
    tfTimeH.setColumns(2);
    tfTimeM.setInputVerifier(new TextFieldNumberVerifier(0, 59));
    tfTimeM.setColumns(2);

    final JPanel pnlHolder = new JPanel();
    pnlHolder.setLayout(new TableLayout(columns, rows));
    pnlHolder.setBorder(tfSeries.getBorder());

    radioDaily.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setMode(DAILY_MODE);
        }
    });
    radioWeekly.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setMode(WEEKLY_MODE);
        }
    });
    radioMonthly.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setMode(MONTHLY_MODE);
        }
    });
    radioYearly.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setMode(YEARLY_MODE);
        }
    });
    radioNoMode.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setMode(NO_MODE);
        }
    });

    bgMainModus.add(radioDaily);
    bgMainModus.add(radioWeekly);
    bgMainModus.add(radioMonthly);
    bgMainModus.add(radioYearly);
    bgMainModus.add(radioNoMode);

    pnlHolder.add(radioDaily, getConstraints(1, 1, 1, 1));
    pnlHolder.add(radioWeekly, getConstraints(1, 1, 2, 2));
    pnlHolder.add(radioMonthly, getConstraints(1, 1, 3, 3));
    pnlHolder.add(radioYearly, getConstraints(1, 1, 4, 4));
    if (isNoModeAvaiable) {
        pnlHolder.add(radioNoMode, getConstraints(1, 1, 5, 5));
    }
    pnlHolder.add(new JSeparator(SwingConstants.VERTICAL),
            getConstraints(2, 2, 1, 5, TableLayoutConstants.CENTER, TableLayoutConstants.FULL));

    final JLabel labStartTime = new JLabel("Uhrzeit  ");

    constraintsPnlTime = getConstraints(1, 4, 1, 1);
    pnlTime = new JPanel(new TableLayout(
            new double[] { 2.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 2.0 },
            new double[] { 4.0, 21.0, 4.0 }));
    pnlTime.add(labStartTime, getConstraints(1, 1, 1, 1));
    pnlTime.add(tfTimeH, getConstraints(2, 2, 1, 1));
    pnlTime.add(new JLabel(" : "), getConstraints(3, 3, 1, 1));
    pnlTime.add(tfTimeM, getConstraints(4, 4, 1, 1));

    final TableLayoutConstraints constraintsRight = getConstraints(3, 3, 1, 5, TableLayoutConstants.FULL,
            TableLayoutConstants.FULL);

    pnlEmpty = new JPanel(new TableLayout());
    pnlHolder.add(pnlEmpty, constraintsRight);

    /**
     * DAILY MODE
     */
    pnlDailyMode = new JPanel(new TableLayout(
            new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, 4.0 },
            new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel
                    21.0, 21.0, 4.0 }));

    tfDailyDays.setColumns(4);
    tfDailyDays.setInputVerifier(new TextFieldNumberVerifier(1, 366));

    radioDailyAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            tfDailyDays.setEnabled(true);
        }
    });
    radioDailyWorking.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            tfDailyDays.setEnabled(false);
        }
    });

    final ButtonGroup bgDailyMode = new ButtonGroup();
    bgDailyMode.add(this.radioDailyAll);
    bgDailyMode.add(this.radioDailyWorking);

    radioDailyAll.addActionListener(this);
    radioDailyWorking.addActionListener(this);

    pnlDailyMode.add(radioDailyAll, getConstraints(1, 1, 2, 2));
    pnlDailyMode.add(radioDailyWorking, getConstraints(1, 3, 3, 3));
    pnlDailyMode.add(tfDailyDays, getConstraints(2, 2, 2, 2));
    pnlDailyMode.add(new JLabel(" Tag(e)"), getConstraints(3, 3, 2, 2));

    pnlHolder.add(pnlDailyMode, constraintsRight);

    /**
     * WEEKLY MODE
     */
    pnlWeeklyMode = new JPanel(new TableLayout(
            new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, 4.0 },
            new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel
                    21.0, 21.0, 21.0, 21.0, 21.0, 4.0 }));

    tfWeeklyWeeks.setColumns(3);
    tfWeeklyWeeks.setInputVerifier(new TextFieldNumberVerifier(1, 53));

    pnlWeeklyMode.add(new JLabel("Jede/Alle  "), getConstraints(1, 1, 2, 2));
    pnlWeeklyMode.add(tfWeeklyWeeks, getConstraints(2, 2, 2, 2));
    pnlWeeklyMode.add(new JLabel(" Woche(n) am"), getConstraints(3, 3, 2, 2));
    pnlWeeklyMode.add(checkMonday, getConstraints(1, 2, 3, 3));
    pnlWeeklyMode.add(checkTuesday, getConstraints(1, 2, 4, 4));
    pnlWeeklyMode.add(checkWednesday, getConstraints(1, 2, 5, 5));
    pnlWeeklyMode.add(checkThursday, getConstraints(1, 2, 6, 6));
    pnlWeeklyMode.add(checkFriday, getConstraints(3, 3, 3, 3));
    pnlWeeklyMode.add(checkSaturday, getConstraints(3, 3, 4, 4));
    pnlWeeklyMode.add(checkSunday, getConstraints(3, 3, 5, 5));

    checkMonday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkMonday.setSelected(true);
        }
    });
    checkMonday.addActionListener(this);
    checkTuesday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkTuesday.setSelected(true);
        }
    });
    checkTuesday.addActionListener(this);
    checkWednesday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkWednesday.setSelected(true);
        }
    });
    checkWednesday.addActionListener(this);
    checkThursday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkThursday.setSelected(true);
        }
    });
    checkThursday.addActionListener(this);
    checkFriday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkFriday.setSelected(true);
        }
    });
    checkFriday.addActionListener(this);
    checkSaturday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkSaturday.setSelected(true);
        }
    });
    checkSaturday.addActionListener(this);
    checkSunday.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isAtLeastOneWeekdaySelected())
                checkSunday.setSelected(true);
        }
    });
    checkSunday.addActionListener(this);

    pnlHolder.add(pnlWeeklyMode, constraintsRight);

    /**
     * MONTHLY MODE
     */
    pnlMonthlyMode = new JPanel(new TableLayout(
            new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 },
            new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel
                    21.0, 21.0, 26.0, 21.0, 4.0 }));

    final ButtonGroup bgMonthlyMode = new ButtonGroup();
    radioMonthly1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            tfMonthly1Day.setEnabled(true);
            tfMonthly1Month.setEnabled(true);
            comboMonthly2Number.setEnabled(false);
            comboMonthly2Weekday.setEnabled(false);
            tfMonthly2Month.setEnabled(false);
        }

    });
    radioMonthly1.addActionListener(this);
    radioMonthly2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            tfMonthly1Day.setEnabled(false);
            tfMonthly1Month.setEnabled(false);
            comboMonthly2Number.setEnabled(true);
            comboMonthly2Weekday.setEnabled(true);
            tfMonthly2Month.setEnabled(true);
        }

    });
    radioMonthly2.addActionListener(this);

    bgMonthlyMode.add(radioMonthly1);
    bgMonthlyMode.add(radioMonthly2);

    tfMonthly1Day.setColumns(3);
    tfMonthly1Day.setInputVerifier(new TextFieldNumberVerifier(1, 31));
    tfMonthly1Month.setColumns(3);
    tfMonthly1Month.setInputVerifier(new TextFieldNumberVerifier(1, 12));
    tfMonthly2Month.setColumns(3);
    tfMonthly2Month.setInputVerifier(new TextFieldNumberVerifier(1, 12));

    comboMonthly2Number.addActionListener(this);
    for (SeriesListItem sli : SeriesUtils.getNumberItems()) {
        comboMonthly2Number.addItem(sli);
    }

    comboMonthly2Weekday.addActionListener(this);
    for (SeriesListItem sli : SeriesUtils.getWeekdayItems()) {
        comboMonthly2Weekday.addItem(sli);
    }

    pnlMonthlyMode.add(radioMonthly1, getConstraints(1, 1, 2, 2));
    pnlMonthlyMode.add(radioMonthly2,
            getConstraints(1, 1, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM));

    pnlMonthlyMode.add(tfMonthly1Day, getConstraints(2, 2, 2, 2));
    pnlMonthlyMode.add(new JLabel(" . Tag"), getConstraints(3, 3, 2, 2));
    pnlMonthlyMode.add(new JLabel("jedes "), getConstraints(2, 2, 3, 3));
    pnlMonthlyMode.add(tfMonthly1Month, getConstraints(3, 3, 3, 3));
    pnlMonthlyMode.add(new JLabel(" . Monats"), getConstraints(4, 4, 3, 3));

    pnlMonthlyMode.add(comboMonthly2Number,
            getConstraints(2, 3, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM));
    pnlMonthlyMode.add(comboMonthly2Weekday,
            getConstraints(4, 5, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM));
    pnlMonthlyMode.add(new JLabel("jedes "), getConstraints(2, 2, 5, 5));
    pnlMonthlyMode.add(tfMonthly2Month, getConstraints(3, 3, 5, 5));
    pnlMonthlyMode.add(new JLabel(" . Monats"), getConstraints(4, 4, 5, 5));

    pnlHolder.add(pnlMonthlyMode, constraintsRight);

    /**
     * YEARLY MODE
     */
    pnlYearlyMode = new JPanel(new TableLayout(
            new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                    TableLayoutConstants.PREFERRED, 4.0 },
            new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel
                    21.0, 26.0, 21.0, 4.0 }));

    final ButtonGroup bgYearlyMode = new ButtonGroup();
    radioYearly1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            tfYearly1Day.setEnabled(true);
            comboYearly1Month.setEnabled(true);
            comboYearly2Number.setEnabled(false);
            comboYearly2Weekday.setEnabled(false);
            comboYearly2Month.setEnabled(false);
        }
    });
    radioYearly1.addActionListener(this);
    radioYearly2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            tfYearly1Day.setEnabled(false);
            comboYearly1Month.setEnabled(false);
            comboYearly2Number.setEnabled(true);
            comboYearly2Weekday.setEnabled(true);
            comboYearly2Month.setEnabled(true);
        }
    });
    radioYearly2.addActionListener(this);

    bgYearlyMode.add(radioYearly1);
    bgYearlyMode.add(radioYearly2);

    tfYearly1Day.setColumns(3);
    tfYearly1Day.setInputVerifier(new TextFieldNumberVerifier(1, 31));

    comboYearly1Month.addActionListener(this);
    for (SeriesListItem sli : SeriesUtils.getMonthItems()) {
        comboYearly1Month.addItem(sli);
    }

    comboYearly2Number.addActionListener(this);
    for (SeriesListItem sli : SeriesUtils.getNumberItems()) {
        comboYearly2Number.addItem(sli);
    }

    comboYearly2Weekday.addActionListener(this);
    for (SeriesListItem sli : SeriesUtils.getWeekdayItems()) {
        comboYearly2Weekday.addItem(sli);
    }

    comboYearly2Month.addActionListener(this);
    for (SeriesListItem sli : SeriesUtils.getMonthItems()) {
        comboYearly2Month.addItem(sli);
    }

    pnlYearlyMode.add(radioYearly1, getConstraints(1, 1, 2, 2));
    pnlYearlyMode.add(radioYearly2,
            getConstraints(1, 1, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM));

    pnlYearlyMode.add(tfYearly1Day, getConstraints(2, 2, 2, 2));
    pnlYearlyMode.add(new JLabel(" . "), getConstraints(3, 3, 2, 2));
    pnlYearlyMode.add(comboYearly1Month, getConstraints(4, 5, 2, 2));

    pnlYearlyMode.add(comboYearly2Number,
            getConstraints(2, 3, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM));
    pnlYearlyMode.add(comboYearly2Weekday,
            getConstraints(4, 5, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM));
    pnlYearlyMode.add(new JLabel("im "), getConstraints(2, 2, 4, 4));
    pnlYearlyMode.add(comboYearly2Month, getConstraints(3, 5, 4, 4));

    pnlHolder.add(pnlYearlyMode, constraintsRight);

    resetAllInputFieldsToDefault();

    /*
     * add "Main" Panel
     */
    this.add(pnlHolder, BorderLayout.CENTER);
}

From source file:org.nyu.edu.dlts.dbCopyFrame.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    apiLabel = new JLabel();
    panel4 = new JPanel();
    label9 = new JLabel();
    beanShellRadioButton = new JRadioButton();
    jrubyRadioButton = new JRadioButton();
    pythonRadioButton = new JRadioButton();
    javascriptRadioButton = new JRadioButton();
    loadExcelFileButton = new JButton();
    excelTextField = new JTextField();
    loadMapperScriptButton = new JButton();
    mapperScriptTextField = new JTextField();
    editScriptButton = new JButton();
    separator2 = new JSeparator();
    panel5 = new JPanel();
    createRepositoryCheckBox = new JCheckBox();
    repoShortNameTextField = new JTextField();
    repoNameTextField = new JTextField();
    repoCodeTextField = new JTextField();
    repoURLTextField = new JTextField();
    panel2 = new JPanel();
    label1 = new JLabel();
    label3 = new JLabel();
    label10 = new JLabel();
    locationsTextField = new JTextField();
    locationsLabel = new JLabel();
    label5 = new JLabel();
    subjectsTextField = new JTextField();
    subjectsLabel = new JLabel();
    label4 = new JLabel();
    namesTextField = new JTextField();
    namesLabel = new JLabel();
    label6 = new JLabel();
    accessionsTextField = new JTextField();
    accessionsLabel = new JLabel();
    label7 = new JLabel();
    digitalObjectsTextField = new JTextField();
    digitalObjectLabel = new JLabel();
    label8 = new JLabel();
    resourcesTextField = new JTextField();
    resourcesLabel = new JLabel();
    separator1 = new JSeparator();
    copyToASpaceButton = new JButton();
    hostLabel = new JLabel();
    hostTextField = new JTextField();
    simulateCheckBox = new JCheckBox();
    adminLabel = new JLabel();
    adminTextField = new JTextField();
    adminPasswordLabel = new JLabel();
    adminPasswordTextField = new JTextField();
    label2 = new JLabel();
    repositoryURITextField = new JTextField();
    developerModeCheckBox = new JCheckBox();
    outputConsoleLabel = new JLabel();
    copyProgressBar = new JProgressBar();
    scrollPane1 = new JScrollPane();
    consoleTextArea = new JTextArea();
    recordURIComboBox = new JComboBox();
    panel1 = new JPanel();
    paramsLabel = new JLabel();
    paramsTextField = new JTextField();
    viewRecordButton = new JButton();
    buttonBar = new JPanel();
    errorLogButton = new JButton();
    saveErrorsLabel = new JLabel();
    errorCountLabel = new JLabel();
    stopButton = new JButton();
    utillitiesButton = new JButton();
    okButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle("Archives Space Excel Data Migrator");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {//from  w  ww .  jav a  2 s .c om
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC },
                    new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(RowSpec.TOP, Sizes.DEFAULT, FormSpec.NO_GROW),
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));

            //---- apiLabel ----
            apiLabel.setText("  Archives Space Version: v1.1.0");
            apiLabel.setHorizontalTextPosition(SwingConstants.CENTER);
            apiLabel.setFont(new Font("Lucida Grande", Font.BOLD, 14));
            contentPanel.add(apiLabel, cc.xy(1, 1));

            //======== panel4 ========
            {
                panel4.setLayout(new FormLayout(
                        new ColumnSpec[] {
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) },
                        RowSpec.decodeSpecs("default")));

                //---- label9 ----
                label9.setText("Select Script Type");
                panel4.add(label9, cc.xy(1, 1));

                //---- beanShellRadioButton ----
                beanShellRadioButton.setText("Beanshell");
                beanShellRadioButton.setSelected(true);
                beanShellRadioButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        clearMapperScript();
                    }
                });
                panel4.add(beanShellRadioButton, cc.xy(3, 1));

                //---- jrubyRadioButton ----
                jrubyRadioButton.setText("JRuby");
                jrubyRadioButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        clearMapperScript();
                    }
                });
                panel4.add(jrubyRadioButton, cc.xy(5, 1));

                //---- pythonRadioButton ----
                pythonRadioButton.setText("Jython");
                pythonRadioButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        clearMapperScript();
                    }
                });
                panel4.add(pythonRadioButton, cc.xy(7, 1));

                //---- javascriptRadioButton ----
                javascriptRadioButton.setText("Javascript");
                javascriptRadioButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        clearMapperScript();
                    }
                });
                panel4.add(javascriptRadioButton, cc.xy(9, 1));
            }
            contentPanel.add(panel4, cc.xywh(3, 1, 7, 1));

            //---- loadExcelFileButton ----
            loadExcelFileButton.setText("Load Excel File");
            loadExcelFileButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    loadExcelFileButtonActionPerformed();
                }
            });
            contentPanel.add(loadExcelFileButton, cc.xy(1, 3));
            contentPanel.add(excelTextField, cc.xywh(3, 3, 5, 1));

            //---- loadMapperScriptButton ----
            loadMapperScriptButton.setText("Load Mapper Script");
            loadMapperScriptButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    loadMapperScriptButtonActionPerformed();
                }
            });
            contentPanel.add(loadMapperScriptButton, cc.xy(1, 5));

            //---- mapperScriptTextField ----
            mapperScriptTextField.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    loadMapperScript();
                }
            });
            contentPanel.add(mapperScriptTextField, cc.xywh(3, 5, 5, 1));

            //---- editScriptButton ----
            editScriptButton.setText("Edit");
            editScriptButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    editScriptButtonActionPerformed();
                }
            });
            contentPanel.add(editScriptButton, cc.xy(9, 5));
            contentPanel.add(separator2, cc.xywh(1, 7, 9, 1));

            //======== panel5 ========
            {
                panel5.setLayout(new FormLayout(ColumnSpec.decodeSpecs("default:grow"),
                        new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC }));

                //---- createRepositoryCheckBox ----
                createRepositoryCheckBox.setText("Create Repository");
                createRepositoryCheckBox.setSelected(true);
                panel5.add(createRepositoryCheckBox, cc.xy(1, 1));

                //---- repoShortNameTextField ----
                repoShortNameTextField.setText("Repo Short Name 1");
                panel5.add(repoShortNameTextField, cc.xy(1, 3));

                //---- repoNameTextField ----
                repoNameTextField.setText("Repo Name 1");
                panel5.add(repoNameTextField, cc.xy(1, 5));

                //---- repoCodeTextField ----
                repoCodeTextField.setText("Organization Code 1");
                panel5.add(repoCodeTextField, cc.xy(1, 7));

                //---- repoURLTextField ----
                repoURLTextField.setText("http://repository.url.org");
                panel5.add(repoURLTextField, cc.xy(1, 9));
            }
            contentPanel.add(panel5, cc.xy(1, 9));

            //======== panel2 ========
            {
                panel2.setLayout(new FormLayout("default, default:grow, right:default",
                        "default, default, default, fill:default:grow, fill:default:grow, default, fill:default:grow"));

                //---- label1 ----
                label1.setText("Record Type");
                panel2.add(label1, cc.xy(1, 1));

                //---- label3 ----
                label3.setText("Spreadsheet Number (starting at 1)");
                panel2.add(label3, cc.xy(2, 1));

                //---- label10 ----
                label10.setText("Locations");
                panel2.add(label10, cc.xy(1, 2));

                //---- locationsTextField ----
                locationsTextField.setText("1");
                panel2.add(locationsTextField, cc.xy(2, 2));

                //---- locationsLabel ----
                locationsLabel.setText("not supported");
                panel2.add(locationsLabel, cc.xy(3, 2));

                //---- label5 ----
                label5.setText("Subjects");
                panel2.add(label5, cc.xy(1, 3));

                //---- subjectsTextField ----
                subjectsTextField.setColumns(2);
                subjectsTextField.setText("2");
                panel2.add(subjectsTextField, cc.xy(2, 3));

                //---- subjectsLabel ----
                subjectsLabel.setText("not supported");
                panel2.add(subjectsLabel, cc.xy(3, 3));

                //---- label4 ----
                label4.setText("Names");
                panel2.add(label4, cc.xy(1, 4));

                //---- namesTextField ----
                namesTextField.setColumns(12);
                namesTextField.setText("3");
                panel2.add(namesTextField, cc.xy(2, 4));

                //---- namesLabel ----
                namesLabel.setText("not supported");
                panel2.add(namesLabel, cc.xy(3, 4));

                //---- label6 ----
                label6.setText("Accessions");
                panel2.add(label6, cc.xy(1, 5));

                //---- accessionsTextField ----
                accessionsTextField.setColumns(2);
                accessionsTextField.setText("4");
                panel2.add(accessionsTextField, cc.xy(2, 5));

                //---- accessionsLabel ----
                accessionsLabel.setText("not supported");
                panel2.add(accessionsLabel, cc.xy(3, 5));

                //---- label7 ----
                label7.setText("Digital Objects");
                panel2.add(label7, cc.xy(1, 6));

                //---- digitalObjectsTextField ----
                digitalObjectsTextField.setColumns(2);
                digitalObjectsTextField.setText("5");
                panel2.add(digitalObjectsTextField, cc.xy(2, 6));

                //---- digitalObjectLabel ----
                digitalObjectLabel.setText("not supported");
                panel2.add(digitalObjectLabel, cc.xy(3, 6));

                //---- label8 ----
                label8.setText("Resources");
                panel2.add(label8, cc.xy(1, 7));

                //---- resourcesTextField ----
                resourcesTextField.setText("6, 7");
                resourcesTextField.setColumns(2);
                panel2.add(resourcesTextField, cc.xy(2, 7));

                //---- resourcesLabel ----
                resourcesLabel.setText("not supported");
                panel2.add(resourcesLabel, cc.xy(3, 7));
            }
            contentPanel.add(panel2, cc.xywh(3, 9, 7, 1));
            contentPanel.add(separator1, cc.xywh(1, 11, 9, 1));

            //---- copyToASpaceButton ----
            copyToASpaceButton.setText("Copy To Archives Space");
            copyToASpaceButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    CopyToASpaceButtonActionPerformed();
                }
            });
            contentPanel.add(copyToASpaceButton, cc.xy(1, 13));

            //---- hostLabel ----
            hostLabel.setText("Archives Space Host");
            contentPanel.add(hostLabel, cc.xywh(3, 13, 2, 1));

            //---- hostTextField ----
            hostTextField.setText("http://localhost:8089");
            contentPanel.add(hostTextField, cc.xywh(5, 13, 5, 1));

            //---- simulateCheckBox ----
            simulateCheckBox.setText("Simulate REST Calls");
            simulateCheckBox.setSelected(true);
            contentPanel.add(simulateCheckBox, cc.xy(1, 15));

            //---- adminLabel ----
            adminLabel.setText("Administrator User ID");
            contentPanel.add(adminLabel, cc.xy(3, 15));

            //---- adminTextField ----
            adminTextField.setText("admin");
            contentPanel.add(adminTextField, cc.xywh(5, 15, 2, 1));

            //---- adminPasswordLabel ----
            adminPasswordLabel.setText("Password");
            contentPanel.add(adminPasswordLabel, cc.xy(7, 15));

            //---- adminPasswordTextField ----
            adminPasswordTextField.setText("admin");
            contentPanel.add(adminPasswordTextField, cc.xy(9, 15));

            //---- label2 ----
            label2.setText("Target Repository URI");
            contentPanel.add(label2, cc.xy(3, 17));
            contentPanel.add(repositoryURITextField, cc.xywh(5, 17, 5, 1));

            //---- developerModeCheckBox ----
            developerModeCheckBox.setText(
                    "Developer Mode (Locations/Names/Subjects are copied once and random IDs are used other records)");
            contentPanel.add(developerModeCheckBox, cc.xywh(1, 19, 9, 1));

            //---- outputConsoleLabel ----
            outputConsoleLabel.setText("Output Console:");
            contentPanel.add(outputConsoleLabel, cc.xy(1, 21));
            contentPanel.add(copyProgressBar, cc.xywh(3, 21, 7, 1));

            //======== scrollPane1 ========
            {

                //---- consoleTextArea ----
                consoleTextArea.setRows(12);
                scrollPane1.setViewportView(consoleTextArea);
            }
            contentPanel.add(scrollPane1, cc.xywh(1, 23, 9, 1));

            //---- recordURIComboBox ----
            recordURIComboBox.setModel(new DefaultComboBoxModel(new String[] { "/repositories", "/users",
                    "/subjects", "/agents/families/1", "/agents/people/1", "/agents/corporate_entities/1",
                    "/repositories/2/accessions/1", "/repositories/2/resources/1",
                    "/repositories/2/archival_objects/1", "/config/enumerations" }));
            recordURIComboBox.setEditable(true);
            contentPanel.add(recordURIComboBox, cc.xy(1, 25));

            //======== panel1 ========
            {
                panel1.setLayout(new FlowLayout(FlowLayout.LEFT));

                //---- paramsLabel ----
                paramsLabel.setText("Params");
                panel1.add(paramsLabel);

                //---- paramsTextField ----
                paramsTextField.setColumns(20);
                panel1.add(paramsTextField);
            }
            contentPanel.add(panel1, cc.xywh(3, 25, 3, 1));

            //---- viewRecordButton ----
            viewRecordButton.setText("View");
            viewRecordButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    viewRecordButtonActionPerformed();
                }
            });
            contentPanel.add(viewRecordButton, cc.xywh(7, 25, 3, 1));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                            FormFactory.GLUE_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                            FormFactory.DEFAULT_COLSPEC, FormFactory.BUTTON_COLSPEC },
                    RowSpec.decodeSpecs("pref")));

            //---- errorLogButton ----
            errorLogButton.setText("View Error Log");
            errorLogButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    errorLogButtonActionPerformed();
                }
            });
            buttonBar.add(errorLogButton, cc.xy(2, 1));

            //---- saveErrorsLabel ----
            saveErrorsLabel.setText(" Errors: ");
            buttonBar.add(saveErrorsLabel, cc.xy(4, 1));

            //---- errorCountLabel ----
            errorCountLabel.setText("N/A ");
            errorCountLabel.setForeground(Color.red);
            errorCountLabel.setFont(new Font("Lucida Grande", Font.BOLD, 13));
            buttonBar.add(errorCountLabel, cc.xy(6, 1));

            //---- stopButton ----
            stopButton.setText("Cancel Copy");
            stopButton.setEnabled(false);
            stopButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    stopButtonActionPerformed();
                    stopButtonActionPerformed();
                }
            });
            buttonBar.add(stopButton, cc.xy(9, 1));

            //---- utillitiesButton ----
            utillitiesButton.setText("Utilities");
            buttonBar.add(utillitiesButton, cc.xy(11, 1));

            //---- okButton ----
            okButton.setText("Close");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed();
                }
            });
            buttonBar.add(okButton, cc.xy(14, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());

    //---- buttonGroup1 ----
    ButtonGroup buttonGroup1 = new ButtonGroup();
    buttonGroup1.add(beanShellRadioButton);
    buttonGroup1.add(jrubyRadioButton);
    buttonGroup1.add(pythonRadioButton);
    buttonGroup1.add(javascriptRadioButton);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:org.omegat.gui.properties.SegmentPropertiesArea.java

@Override
public void populatePaneMenu(JPopupMenu contextMenu) {
    JMenuItem tableModeItem = new JCheckBoxMenuItem(OStrings.getString("SEGPROP_CONTEXTMENU_TABLE_MODE"));
    tableModeItem.setSelected(viewImpl.getClass().equals(SegmentPropertiesTableView.class));
    tableModeItem.addActionListener(new ActionListener() {
        @Override/*from   w  w w  . j ava 2 s . com*/
        public void actionPerformed(ActionEvent e) {
            toggleMode(SegmentPropertiesTableView.class);
        }
    });
    JMenuItem listModeItem = new JCheckBoxMenuItem(OStrings.getString("SEGPROP_CONTEXTMENU_LIST_MODE"));
    listModeItem.setSelected(viewImpl.getClass().equals(SegmentPropertiesListView.class));
    listModeItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            toggleMode(SegmentPropertiesListView.class);
        }
    });
    ButtonGroup group = new ButtonGroup();
    group.add(tableModeItem);
    group.add(listModeItem);
    contextMenu.add(tableModeItem);
    contextMenu.add(listModeItem);
    contextMenu.addSeparator();
    final JMenuItem toggleKeyTranslationItem = new JCheckBoxMenuItem(
            OStrings.getString("SEGPROP_CONTEXTMENU_RAW_KEYS"));
    toggleKeyTranslationItem.setSelected(Preferences.isPreference(Preferences.SEGPROPS_SHOW_RAW_KEYS));
    toggleKeyTranslationItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Preferences.setPreference(Preferences.SEGPROPS_SHOW_RAW_KEYS,
                    toggleKeyTranslationItem.isSelected());
            viewImpl.update();
        }
    });
    contextMenu.add(toggleKeyTranslationItem);
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.PlanComptableGPanel.java

private void uiInit() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    this.setOpaque(false);
    this.panelCompte.setOpaque(false);
    this.panelInfosCompte.setOpaque(false);
    this.panelDetails.setOpaque(false);

    this.panelCompte.setLayout(new GridBagLayout());
    this.panelInfosCompte.setLayout(new GridBagLayout());
    this.panelDetails.setLayout(new GridBagLayout());

    /*******************************************************************************************
     * * RadioButton Selection du mode d'affichage du PCG abrege, base ou developp Panel
     * Details//from ww w  .ja v  a2s .  c  o  m
     ******************************************************************************************/
    this.panelDetails.add(this.radioCompteBase, c);
    this.radioCompteBase.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }
    });

    c.gridy++;
    this.panelDetails.add(this.radioCompteAbrege, c);
    this.radioCompteAbrege.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }
    });

    c.gridy++;
    this.panelDetails.add(this.radioCompteDeveloppe, c);
    this.radioCompteDeveloppe.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }

    });

    ButtonGroup grp1 = new ButtonGroup();
    grp1.add(this.radioCompteBase);
    grp1.add(this.radioCompteAbrege);
    grp1.add(this.radioCompteDeveloppe);

    this.radioCompteBase.setSelected(true);

    /*******************************************************************************************
     * ** Panel Compte
     ******************************************************************************************/
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0;
    c.weighty = 0;
    this.panelDetails.setBorder(BorderFactory.createTitledBorder("Dtails"));
    this.panelCompte.add(this.panelDetails, c);

    /*******************************************************************************************
     * * Affichage du plan comptable
     ******************************************************************************************/
    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable classeCompteTable = base.getTable("CLASSE_COMPTE");

    SQLSelect selClasse = new SQLSelect(base);

    selClasse.addSelect(classeCompteTable.getField("ID"));
    selClasse.addSelect(classeCompteTable.getField("NOM"));
    selClasse.addSelect(classeCompteTable.getField("TYPE_NUMERO_COMPTE"));

    selClasse.addRawOrder("\"CLASSE_COMPTE\".\"TYPE_NUMERO_COMPTE\"");

    String reqClasse = selClasse.asString();
    Object obClasse = base.getDataSource().execute(reqClasse, new ArrayListHandler());

    List myListClasse = (List) obClasse;

    if (myListClasse.size() != 0) {
        for (int k = 0; k < myListClasse.size(); k++) {
            Object[] objTmp = (Object[]) myListClasse.get(k);
            ClasseCompte ccTmp = new ClasseCompte(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString(),
                    objTmp[2].toString());
            this.classeComptes.add(ccTmp);

            JTable tab = creerJTable(ccTmp);
            this.tables.add(tab);
            this.tabbedClasse.add(ccTmp.getNom(), new JScrollPane(tab));
        }
    }
    c.gridwidth = 4;
    c.gridheight = 6;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;
    c.gridx++;
    c.gridy = 0;
    this.panelCompte.add(this.tabbedClasse, c);

    /*******************************************************************************************
     * * Informations sur le compte selectionn Panel Infos Compte
     ******************************************************************************************/
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridheight = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    c.weighty = 0;
    c.gridy = 0;
    c.gridx = 0;
    TitledSeparator sep = new TitledSeparator("Informations sur le compte");
    this.panelInfosCompte.add(sep, c);

    GridBagConstraints cInfos = new GridBagConstraints();
    cInfos.insets = new Insets(0, 0, 0, 0);
    cInfos.fill = GridBagConstraints.BOTH;
    cInfos.anchor = GridBagConstraints.NORTHWEST;
    cInfos.gridx = 0;
    cInfos.gridy = 0;
    cInfos.gridwidth = 1;
    cInfos.gridheight = 1;
    cInfos.weightx = 1;
    cInfos.weighty = 1;
    this.textInfos.setFont(this.getFont());
    this.textInfos.setEditable(false);
    JPanel infos = new JPanel(new GridBagLayout());
    infos.add(this.textInfos, cInfos);

    JScrollPane scrollInfos = new JScrollPane(infos);
    c.insets = new Insets(0, 0, 0, 0);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = GridBagConstraints.REMAINDER;

    this.panelInfosCompte.add(scrollInfos, c);
    this.panelInfosCompte.setMinimumSize(new Dimension(100, 80));

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, this.panelCompte, this.panelInfosCompte);
    split.setBorder(null);
    this.add(split, c);
}