Example usage for javax.swing ButtonGroup ButtonGroup

List of usage examples for javax.swing ButtonGroup ButtonGroup

Introduction

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

Prototype

public ButtonGroup() 

Source Link

Document

Creates a new ButtonGroup.

Usage

From source file:org.zeromeaner.gui.reskin.StandaloneFrame.java

private JToolBar createToolbar() {
    JToolBar t = new JToolBar(JToolBar.VERTICAL);
    t.setFloatable(false);//from ww w  .j  av  a  2s.co m
    t.setLayout(new GridLayout(0, 1));

    ButtonGroup g = new ButtonGroup();

    AbstractButton b;

    b = playButton = new JToggleButton(new ToolbarAction("toolbar.play") {
        @Override
        public void actionPerformed(ActionEvent e) {
            super.actionPerformed(e);
            if (CARD_PLAY.equals(currentCard))
                playCardSelected();
        }
    });
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.modeselect"));
    add(t, g, b);

    b = netplayButton = new JToggleButton(new ToolbarAction("toolbar.netplay") {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (CARD_NETPLAY.equals(currentCard))
                return;
            super.actionPerformed(e);
            netplayCardSelected();
        }
    });
    add(t, g, b);

    /*
    b = new JToggleButton(new ToolbarAction("toolbar.rule_1p"));
    add(t, g, b);
    */

    b = new JToggleButton(new ToolbarAction("toolbar.keys_1p"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.tuning_1p"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.ai_1p"));
    add(t, g, b);

    /*
    b = new JToggleButton(new ToolbarAction("toolbar.rule_2p"));
    add(t, g, b);
     */

    b = new JToggleButton(new ToolbarAction("toolbar.keys_2p"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.tuning_2p"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.ai_2p"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.general"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.open"));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction(CARD_FEEDBACK));
    add(t, g, b);

    b = new JToggleButton(new ToolbarAction("toolbar.close") {
        @Override
        public void actionPerformed(ActionEvent e) {
            StandaloneMain.saveConfig();
            System.exit(0);
        }
    });
    add(t, g, b);

    return t;
}

From source file:pcgen.gui2.dialog.OptionsPathDialog.java

private void initComponents() {
    setResizable(false);// www  . j  ava 2s .c  o  m
    setTitle("Directory for options.ini location");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    getContentPane().setLayout(new GridBagLayout());
    GridBagConstraints gridBagConstraints = new GridBagConstraints();

    JLabel label = new JLabel("Select a directory to store PCGen options in:");
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(4, 4, 0, 4);
    getContentPane().add(label, gridBagConstraints);

    gridBagConstraints.insets = new Insets(2, 0, 2, 0);
    getContentPane().add(new JSeparator(), gridBagConstraints);

    label = new JLabel(
            "If you have an existing options.ini file," + "then select the directory containing that file");
    gridBagConstraints.insets = new Insets(4, 4, 4, 4);
    getContentPane().add(label, gridBagConstraints);

    ActionListener handler = new ActionHandler();
    ButtonGroup group = new ButtonGroup();

    gridBagConstraints.insets = new Insets(0, 4, 0, 4);
    addRadioButton("<html><b>PCGen Dir</b>: This is the directory that PCGen is installed into",
            SettingsFilesPath.pcgen.name(), group, handler, gridBagConstraints);
    // Remark: do mac user really need to be able to put the file either in a specific mac dir or home?
    if (SystemUtils.IS_OS_MAC_OSX) {
        addRadioButton("<html><b>Mac User Dir</b>", SettingsFilesPath.mac_user.name(), group, handler,
                gridBagConstraints);
    } else if (SystemUtils.IS_OS_UNIX) {
        // putting it the same way as mac. merging all and using a system config dir instead would be better IMHO.
        addRadioButton("<html><b>Freedesktop configuration sub-directory</b> Use for most Linux/BSD",
                SettingsFilesPath.FD_USER.name(), group, handler, gridBagConstraints);
    }
    addRadioButton("<html><b>Home Dir</b>: This is your home directory", SettingsFilesPath.user.name(), group,
            handler, gridBagConstraints);
    addRadioButton("Select a directory to use", "select", group, handler, gridBagConstraints);

    dirField.setText(ConfigurationSettings.getSettingsDirFromFilePath(selectedDir));
    dirField.setEditable(false);

    gridBagConstraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagConstraints.weightx = 1;
    gridBagConstraints.insets = new Insets(0, 4, 0, 0);
    getContentPane().add(dirField, gridBagConstraints);

    dirButton.setText("...");
    dirButton.setEnabled(false);
    dirButton.addActionListener(handler);
    dirButton.setActionCommand("custom");
    dirButton.setMargin(new Insets(2, 2, 2, 2));

    GridBagConstraints bagConstraints = new GridBagConstraints();
    bagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    bagConstraints.insets = new Insets(0, 0, 0, 4);
    getContentPane().add(dirButton, bagConstraints);

    JButton okButton = new JButton("OK");
    okButton.setPreferredSize(new Dimension(75, 23));
    okButton.setActionCommand("ok");
    okButton.addActionListener(handler);

    bagConstraints.insets = new Insets(4, 0, 4, 0);
    getContentPane().add(okButton, bagConstraints);
    getRootPane().setDefaultButton(okButton);

    pack();
    setLocationRelativeTo(null);
}

From source file:pcgen.gui2.prefs.LocationPanel.java

/**
 * Instantiates a new location panel./*from  w  w  w .j  a v  a2s  . com*/
 */
public LocationPanel() {
    Border etched = null;
    TitledBorder title1 = BorderFactory.createTitledBorder(etched, IN_LOCATION);

    title1.setTitleJustification(TitledBorder.LEFT);
    this.setBorder(title1);
    GridBagLayout gridbag = new GridBagLayout();
    this.setLayout(gridbag);
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(2, 2, 2, 2);

    Utility.buildConstraints(constraints, 0, 0, 1, 1, 0, 0);
    JLabel label = new JLabel(IN_BROWSER_PATH + ": ");
    gridbag.setConstraints(label, constraints);
    this.add(label);
    Utility.buildConstraints(constraints, 1, 0, 1, 1, 1, 0);
    browserPath = new JTextField(String.valueOf(PCGenSettings.getBrowserPath()));

    // sage_sam 9 April 2003
    browserPath.addFocusListener(textFieldListener);
    gridbag.setConstraints(browserPath, constraints);
    this.add(browserPath);
    Utility.buildConstraints(constraints, 2, 0, 1, 1, 0, 0);
    browserPathButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(browserPathButton, constraints);
    this.add(browserPathButton);
    browserPathButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 1, 1, 1, 1, 0, 0);
    clearBrowserPathButton = new JButton(IN_CLEAR_BROWSER_PATH);
    gridbag.setConstraints(clearBrowserPathButton, constraints);
    this.add(clearBrowserPathButton);
    clearBrowserPathButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 2, 1, 1, 0, 0);
    JLabel in_prefs_pcgenCharacterDir = new JLabel(
            LanguageBundle.getString("in_Prefs_pcgenCharacterDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 2, 1, 1, 0, 0);
    pcgenCharacterDir = new JTextField(String.valueOf(PCGenSettings.getPcgDir()));

    // sage_sam 9 April 2003
    pcgenCharacterDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenCharacterDir, constraints);
    this.add(pcgenCharacterDir);
    Utility.buildConstraints(constraints, 2, 2, 1, 1, 0, 0);
    pcgenCharacterDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenCharacterDirButton, constraints);
    this.add(pcgenCharacterDirButton);
    pcgenCharacterDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 3, 1, 1, 0, 0);

    //TODO i18n
    in_prefs_pcgenCharacterDir = new JLabel("PCGen Portraits Directory" + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 3, 1, 1, 0, 0);
    pcgenPortraitsDir = new JTextField(String.valueOf(PCGenSettings.getPortraitsDir()));

    // sage_sam 9 April 2003
    pcgenPortraitsDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenPortraitsDir, constraints);
    this.add(pcgenPortraitsDir);
    Utility.buildConstraints(constraints, 2, 3, 1, 1, 0, 0);
    pcgenPortraitsDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenPortraitsDirButton, constraints);
    this.add(pcgenPortraitsDirButton);
    pcgenPortraitsDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 4, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenDataDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 4, 1, 1, 0, 0);
    pcgenDataDir = new JTextField(String.valueOf(ConfigurationSettings.getPccFilesDir()));

    // sage_sam 9 April 2003
    pcgenDataDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenDataDir, constraints);
    this.add(pcgenDataDir);
    Utility.buildConstraints(constraints, 2, 4, 1, 1, 0, 0);
    pcgenDataDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenDataDirButton, constraints);
    this.add(pcgenDataDirButton);
    pcgenDataDirButton.addActionListener(prefsButtonHandler);

    //////////////////////
    Utility.buildConstraints(constraints, 0, 5, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenCustomDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 5, 1, 1, 0, 0);
    pcgenCustomDir = new JTextField(String.valueOf(PCGenSettings.getCustomDir()));

    // sage_sam 9 April 2003
    pcgenCustomDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenCustomDir, constraints);
    this.add(pcgenCustomDir);
    Utility.buildConstraints(constraints, 2, 5, 1, 1, 0, 0);
    pcgenCustomDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenCustomDirButton, constraints);
    this.add(pcgenCustomDirButton);
    pcgenCustomDirButton.addActionListener(prefsButtonHandler);

    ////////////////////

    Utility.buildConstraints(constraints, 0, 6, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenVendorDataDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 6, 1, 1, 0, 0);
    pcgenVendorDataDir = new JTextField(String.valueOf(PCGenSettings.getVendorDataDir()));

    // sage_sam 9 April 2003
    pcgenVendorDataDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenVendorDataDir, constraints);
    this.add(pcgenVendorDataDir);
    Utility.buildConstraints(constraints, 2, 6, 1, 1, 0, 0);
    pcgenVendorDataDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenVendorDataDirButton, constraints);
    this.add(pcgenVendorDataDirButton);
    pcgenVendorDataDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 7, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenHomebrewDataDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 7, 1, 1, 0, 0);
    pcgenHomebrewDataDir = new JTextField(String.valueOf(PCGenSettings.getHomebrewDataDir()));

    pcgenHomebrewDataDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenHomebrewDataDir, constraints);
    this.add(pcgenHomebrewDataDir);
    Utility.buildConstraints(constraints, 2, 7, 1, 1, 0, 0);
    pcgenHomebrewDataDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenHomebrewDataDirButton, constraints);
    this.add(pcgenHomebrewDataDirButton);
    pcgenHomebrewDataDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 8, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenDocsDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 8, 1, 1, 0, 0);
    pcgenDocsDir = new JTextField(String.valueOf(ConfigurationSettings.getDocsDir()));

    // sage_sam 9 April 2003
    pcgenDocsDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenDocsDir, constraints);
    this.add(pcgenDocsDir);
    Utility.buildConstraints(constraints, 2, 8, 1, 1, 0, 0);
    pcgenDocsDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenDocsDirButton, constraints);
    this.add(pcgenDocsDirButton);
    pcgenDocsDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 9, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenSystemDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 9, 1, 1, 0, 0);
    pcgenSystemDir = new JTextField(String.valueOf(ConfigurationSettings.getSystemsDir()));

    // sage_sam 9 April 2003
    pcgenSystemDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenSystemDir, constraints);
    this.add(pcgenSystemDir);
    Utility.buildConstraints(constraints, 2, 9, 1, 1, 0, 0);
    pcgenSystemDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenSystemDirButton, constraints);
    this.add(pcgenSystemDirButton);
    pcgenSystemDirButton.addActionListener(prefsButtonHandler);

    // Output Sheet directory
    Utility.buildConstraints(constraints, 0, 10, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenOutputSheetDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 10, 1, 1, 0, 0);
    pcgenOutputSheetDir = new JTextField(String.valueOf(ConfigurationSettings.getOutputSheetsDir()));
    pcgenOutputSheetDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenOutputSheetDir, constraints);
    this.add(pcgenOutputSheetDir);
    Utility.buildConstraints(constraints, 2, 10, 1, 1, 0, 0);
    pcgenOutputSheetDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenOutputSheetDirButton, constraints);
    this.add(pcgenOutputSheetDirButton);
    pcgenOutputSheetDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 11, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenPreviewDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 11, 1, 1, 0, 0);
    pcgenPreviewDir = new JTextField(String.valueOf(ConfigurationSettings.getPreviewDir()));
    pcgenPreviewDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenPreviewDir, constraints);
    this.add(pcgenPreviewDir);
    Utility.buildConstraints(constraints, 2, 11, 1, 1, 0, 0);
    pcgenPreviewDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenPreviewDirButton, constraints);
    this.add(pcgenPreviewDirButton);
    pcgenPreviewDirButton.addActionListener(prefsButtonHandler);

    // Character File Backup directory
    Utility.buildConstraints(constraints, 0, 12, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(
            LanguageBundle.getString("in_Prefs_pcgenCreateBackupCharacter") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 12, 1, 1, 0, 0);
    gridbag.setConstraints(pcgenCreateBackupCharacter, constraints);
    this.add(pcgenCreateBackupCharacter);

    Utility.buildConstraints(constraints, 0, 13, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(
            LanguageBundle.getString("in_Prefs_pcgenBackupCharacterDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 13, 1, 1, 0, 0);
    pcgenBackupCharacterDir = new JTextField(String.valueOf(PCGenSettings.getBackupPcgDir()));
    pcgenBackupCharacterDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenBackupCharacterDir, constraints);
    this.add(pcgenBackupCharacterDir);
    Utility.buildConstraints(constraints, 2, 13, 1, 1, 0, 0);
    pcgenBackupCharacterDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenBackupCharacterDirButton, constraints);
    this.add(pcgenBackupCharacterDirButton);
    pcgenBackupCharacterDirButton.addActionListener(prefsButtonHandler);

    // Where to store options.ini file
    Utility.buildConstraints(constraints, 0, 14, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenFilesDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);

    pcgenFilesDirRadio = new JRadioButton("PCGen Dir");
    usersFilesDirRadio = new JRadioButton("Home Dir");
    selectFilesDirRadio = new JRadioButton("Select a directory");
    pcgenFilesDir = new JTextField(String.valueOf(ConfigurationSettings.getSettingsDir()));
    pcgenFilesDir.addFocusListener(textFieldListener);

    String fType = ConfigurationSettings.getSystemProperty(ConfigurationSettings.SETTINGS_FILES_PATH);

    if ((fType == null) || (fType.length() < 1)) {
        // make sure we have a default
        fType = ConfigurationSettings.getDefaultSettingsFilesPath();
        ConfigurationSettings.setSystemProperty(ConfigurationSettings.SETTINGS_FILES_PATH, fType);
    }

    pcgenFilesDir.setText(ConfigurationSettings.getSettingsDir());
    if (fType.equals(SettingsFilesPath.pcgen.name())) {
        pcgenFilesDirRadio.setSelected(true);
    } else if (fType.equals(SettingsFilesPath.user.name()) || fType.equals(SettingsFilesPath.mac_user.name())
            || fType.equals(SettingsFilesPath.FD_USER.name())) {
        usersFilesDirRadio.setSelected(true);
    } else {
        selectFilesDirRadio.setSelected(true);
    }

    Utility.buildConstraints(constraints, 0, 15, 1, 1, 0, 0);
    gridbag.setConstraints(pcgenFilesDirRadio, constraints);
    this.add(pcgenFilesDirRadio);
    Utility.buildConstraints(constraints, 1, 15, 1, 1, 0, 0);
    gridbag.setConstraints(usersFilesDirRadio, constraints);
    this.add(usersFilesDirRadio);

    groupFilesDir = new ButtonGroup();
    groupFilesDir.add(pcgenFilesDirRadio);
    groupFilesDir.add(usersFilesDirRadio);
    groupFilesDir.add(selectFilesDirRadio);

    pcgenFilesDirRadio.addActionListener(evt -> {
        pcgenFilesDir.setText(SettingsFilesPath.pcgen.getSettingsDir());
        pcgenFilesDirButton.setEnabled(false);
    });
    usersFilesDirRadio.addActionListener(evt -> {
        pcgenFilesDir.setText(ConfigurationSettings.getUserSettingsDirFromFilePath());
        pcgenFilesDirButton.setEnabled(false);
    });
    selectFilesDirRadio.addActionListener(evt -> {
        pcgenFilesDir.setText("");
        pcgenFilesDirButton.setEnabled(true);
    });

    Utility.buildConstraints(constraints, 0, 16, 1, 1, 0, 0);
    gridbag.setConstraints(selectFilesDirRadio, constraints);
    this.add(selectFilesDirRadio);
    Utility.buildConstraints(constraints, 1, 16, 1, 1, 0, 0);
    gridbag.setConstraints(pcgenFilesDir, constraints);
    this.add(pcgenFilesDir);
    Utility.buildConstraints(constraints, 2, 16, 1, 1, 0, 0);
    pcgenFilesDirButton = new JButton(IN_CHOOSE);
    pcgenFilesDirButton.setEnabled(selectFilesDirRadio.isSelected());
    gridbag.setConstraints(pcgenFilesDirButton, constraints);
    this.add(pcgenFilesDirButton);
    pcgenFilesDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 20, 3, 1, 1, 1);
    constraints.fill = GridBagConstraints.BOTH;
    JLabel emptyLabel = new JLabel(" ");

    gridbag.setConstraints(emptyLabel, constraints);
    this.add(emptyLabel);
}

From source file:pcgen.gui2.prefs.LookAndFeelPanel.java

/**
 * Instantiates a new look and feel panel.
 *//*w  w  w. j  a v a 2 s  .c om*/
public LookAndFeelPanel(Dialog parent) {

    JLabel label;
    ButtonGroup exclusiveGroup;
    Border etched = null;
    TitledBorder title1 = BorderFactory.createTitledBorder(etched, IN_LOOK_AND_FEEL);

    title1.setTitleJustification(TitledBorder.LEFT);
    this.setBorder(title1);
    GridBagLayout gridbag = new GridBagLayout();
    this.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(2, 2, 2, 2);

    exclusiveGroup = new ButtonGroup();
    Action[] actions = LookAndFeelManager.getActions();
    laf = new JRadioButton[actions.length - 1];

    for (int i = 0; i < laf.length; ++i) {
        laf[i] = new JRadioButton(actions[i]);

        int whichChar = (laf[i].getText().charAt(0) == 'C') ? 1 : 0;
        laf[i].setMnemonic(laf[i].getText().charAt(whichChar));

        Utility.buildConstraints(c, 0, i, 3, 1, 0, 0);
        gridbag.setConstraints(laf[i], c);
        this.add(laf[i]);
        exclusiveGroup.add(laf[i]);
    }

    skinnedLookFeel.addActionListener(actions[actions.length - 1]);
    skinnedLookFeel.setText(IN_SKINNED_LAF + ": ");
    skinnedLookFeel.setToolTipText(LanguageBundle.getString("in_Prefs_skinnedLAFTooltip"));
    skinnedLookFeel.setMnemonic(LanguageBundle.getMnemonic("in_mn_Prefs_skinnedLAF"));
    Utility.buildConstraints(c, 0, laf.length, 3, 1, 0, 0);
    gridbag.setConstraints(skinnedLookFeel, c);
    this.add(skinnedLookFeel);
    exclusiveGroup.add(skinnedLookFeel);

    Utility.buildConstraints(c, 3, laf.length, 1, 1, 1, 0);
    themepackLabel = new JTextField(LookAndFeelManager.getCurrentThemePack());
    themepackLabel.setEditable(false);
    gridbag.setConstraints(themepackLabel, c);
    this.add(themepackLabel);
    Utility.buildConstraints(c, 4, laf.length, 1, 1, 0, 0);
    themepack = new JButton(IN_CHOOSE);
    themepack.setToolTipText(LanguageBundle.getString("in_Prefs_chooseSkinTooltip"));
    gridbag.setConstraints(themepack, c);
    this.add(themepack);
    themepack.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(c, 0, laf.length + 1, 5, 1, 0, 0);
    label = new JLabel("");
    gridbag.setConstraints(label, c);
    this.add(label);

    Utility.buildConstraints(c, 0, laf.length + 2, 5, 1, 0, 0);
    label = new JLabel(LanguageBundle.getString("in_Prefs_restartInfo"));
    gridbag.setConstraints(label, c);
    this.add(label);

    Utility.buildConstraints(c, 0, 20, 5, 1, 1, 1);
    c.fill = GridBagConstraints.BOTH;
    label = new JLabel(" ");
    gridbag.setConstraints(label, c);
    this.add(label);
}

From source file:phex.gui.dialogs.ExportDialog.java

private void initComponents() {
    closeEventHandler = new CloseEventHandler();
    addWindowListener(closeEventHandler);

    DefaultComboBoxModel model = new DefaultComboBoxModel();
    model.insertElementAt(Localizer.getString("ExportDialog_DefaultHTMLExport"), DEFAULT_HTML_INDEX);
    model.insertElementAt(Localizer.getString("ExportDialog_MagmaYAMLExport"), DEFAULT_MAGMA_YAML_INDEX);
    model.insertElementAt(Localizer.getString("ExportDialog_MetalinkXMLExport"), DEFAULT_METALINK_XML_INDEX);
    model.insertElementAt(Localizer.getString("ExportDialog_RSSXMLExport"), DEFAULT_RSS_XML_INDEX);

    standardExport = new JRadioButton(Localizer.getString("ExportDialog_StandardExportFormat"));
    standardExport.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            replaceFileExtForStandardExport();
        }/*from w  w w  . j a v a2s  .c  om*/
    });

    customExport = new JRadioButton(Localizer.getString("ExportDialog_CustomExportFormat"));
    customExport.setToolTipText(Localizer.getString("ExportDialog_TTTCustomExportFormat"));
    ButtonGroup exportFormatGroup = new ButtonGroup();
    exportFormatGroup.add(standardExport);
    exportFormatGroup.add(customExport);
    standardExport.setSelected(true);

    standardExportFormatCB = new JComboBox(model);
    standardExportFormatCB.addActionListener(new ExportTypeListener());

    customExportFormatTF = new JTextField(40);
    customExportFormatTF.setToolTipText(Localizer.getString("ExportDialog_TTTCustomExportFormat"));
    customExportFormatTF.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent e) {
            customExport.setSelected(true);
        }

        public void keyReleased(KeyEvent e) {
            customExport.setSelected(true);
        }

        public void keyTyped(KeyEvent e) {
            customExport.setSelected(true);
        }
    });

    browseCustomFormat = new JButton(Localizer.getString("ExportDialog_Browse"));
    browseCustomFormat.addActionListener(new BrowseCustomFileBtnListener());

    exportAllFiles = new JRadioButton(Localizer.getString("ExportDialog_ExportAllFiles"));
    // text will be set on initContent()
    exportSelectedFiles = new JRadioButton();
    ButtonGroup exportSourceGroup = new ButtonGroup();
    exportSourceGroup.add(exportAllFiles);
    exportSourceGroup.add(exportSelectedFiles);

    outputFileTF = new JTextField(40);
    File defOutFile = new File(SystemUtils.USER_HOME, "shared_files.html");
    outputFileTF.setText(defOutFile.getAbsolutePath());

    browseOutFile = new JButton(Localizer.getString("ExportDialog_Browse"));
    browseOutFile.addActionListener(new BrowseOutFileBtnListener());

    magnetInclXs = new JCheckBox(Localizer.getString("ExportDialog_MagnetIncludeXS"));
    magnetInclXs.setToolTipText(Localizer.getString("ExportDialog_TTTMagnetIncludeXS"));

    magnetInclFreebase = new JCheckBox(Localizer.getString("ExportDialog_MagnetIncludeFreebase"));
    magnetInclFreebase.setToolTipText(Localizer.getString("ExportDialog_TTTMagnetIncludeFreebase"));

    // delay setting initial index to ensure all components are available
    standardExportFormatCB.setSelectedIndex(0);

    okBtn = new JButton(Localizer.getString("OK"));
    okBtn.addActionListener(new OkBtnListener());

    cancelBtn = new JButton(Localizer.getString("Cancel"));
    cancelBtn.addActionListener(closeEventHandler);
}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

private void initExperimental() {
    JMenu menu = new JMenu("Experimental");
    menu.add(new JLabel("Experimental features, can have bugs", Icons.LEVEL_WARNING, SwingConstants.LEADING));
    menu.add(new JSeparator());
    boolean storeOnDisk = StringUtils.equalsIgnoreCase(System.getProperty("cacheEvents"), "true");
    JRadioButtonMenuItem radioButtonMemory = new JRadioButtonMenuItem("Memory - faster, more memory required",
            !storeOnDisk);/*from www. j a v  a2 s . co  m*/
    radioButtonMemory.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.setProperty("cacheEvents", Boolean.FALSE.toString());
        }
    });
    JRadioButtonMenuItem radioButtonDisk = new JRadioButtonMenuItem(
            "Disk with caching - slower, less memory required", storeOnDisk);
    radioButtonDisk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.setProperty("cacheEvents", Boolean.TRUE.toString());
        }
    });
    final ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(radioButtonDisk);
    buttonGroup.add(radioButtonMemory);
    menu.add(new JSeparator(JSeparator.VERTICAL));
    menu.add(new JLabel("Keep parsed log events store:"));
    menu.add(radioButtonMemory);
    menu.add(radioButtonDisk);
    final JCheckBox soapFormatterRemoveMultirefsCbx = new JCheckBox();
    soapFormatterRemoveMultirefsCbx
            .setSelected(configuration.getBoolean(ConfKeys.FORMATTER_SOAP_REMOVE_MULTIREFS, false));
    AbstractAction enableMultiRefRemoveFeature = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SoapMessageFormatter soapMessageFormatter = (SoapMessageFormatter) AllPluginables.getInstance()
                    .getMessageFormatters().getElement(SoapMessageFormatter.class.getName());
            soapMessageFormatter.setRemoveMultiRefs(soapFormatterRemoveMultirefsCbx.isSelected());
            configuration.setProperty(ConfKeys.FORMATTER_SOAP_REMOVE_MULTIREFS,
                    soapFormatterRemoveMultirefsCbx.isSelected());
        }
    };
    enableMultiRefRemoveFeature.putValue(Action.NAME, "Remove mulitRefs from SOAP messages");
    soapFormatterRemoveMultirefsCbx.setAction(enableMultiRefRemoveFeature);
    enableMultiRefRemoveFeature.actionPerformed(null);
    final JCheckBox soapFormatterRemoveXsiForNilElementsCbx = new JCheckBox();
    soapFormatterRemoveXsiForNilElementsCbx
            .setSelected(configuration.getBoolean(FORMATTER_SOAP_REMOVE_XSI_FOR_NIL, false));
    AbstractAction soapFormatterRemoveXsiFromNilAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SoapMessageFormatter soapMessageFormatter = (SoapMessageFormatter) AllPluginables.getInstance()
                    .getMessageFormatters().getElement(SoapMessageFormatter.class.getName());
            soapMessageFormatter
                    .setRemoveXsiForNilElements(soapFormatterRemoveXsiForNilElementsCbx.isSelected());
            configuration.setProperty(FORMATTER_SOAP_REMOVE_XSI_FOR_NIL,
                    soapFormatterRemoveXsiForNilElementsCbx.isSelected());
        }
    };
    soapFormatterRemoveXsiFromNilAction.putValue(Action.NAME,
            "Remove xsi for for NIL elements from SOAP messages");
    soapFormatterRemoveXsiForNilElementsCbx.setAction(soapFormatterRemoveXsiFromNilAction);
    soapFormatterRemoveXsiFromNilAction.actionPerformed(null);
    menu.add(soapFormatterRemoveMultirefsCbx);
    menu.add(soapFormatterRemoveXsiForNilElementsCbx);
    getJMenuBar().add(menu);
    QueryFilter queryFilter = new QueryFilter();
    allPluginables.getLogFiltersContainer().addElement(queryFilter);
    JButton b = new JButton("Throw exception");
    b.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (System.currentTimeMillis() % 2 == 0) {
                throw new RuntimeException("Exception swing action!");
            } else {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        throw new RuntimeException("Exception from tread!");
                    }
                }).start();
            }
        }
    });
    menu.add(b);
}

From source file:processing.app.Base.java

public void rebuildBoardsMenu() throws Exception {
    boardsCustomMenus = new LinkedList<>();

    // The first custom menu is the "Board" selection submenu
    JMenu boardMenu = new JMenu(tr("Board"));
    boardMenu.putClientProperty("removeOnWindowDeactivation", true);
    MenuScroller.setScrollerFor(boardMenu).setTopFixedCount(1);

    boardMenu.add(new JMenuItem(new AbstractAction(tr("Boards Manager...")) {
        public void actionPerformed(ActionEvent actionevent) {
            String filterText = "";
            String dropdownItem = "";
            if (actionevent instanceof Event) {
                filterText = ((Event) actionevent).getPayload().get("filterText").toString();
                dropdownItem = ((Event) actionevent).getPayload().get("dropdownItem").toString();
            }//from   www.j  a v  a 2  s .  c o  m
            try {
                openBoardsManager(filterText, dropdownItem);
            } catch (Exception e) {
                //TODO show error
                e.printStackTrace();
            }
        }
    }));
    boardsCustomMenus.add(boardMenu);

    // If there are no platforms installed we are done
    if (BaseNoGui.packages.size() == 0)
        return;

    // Separate "Install boards..." command from installed boards
    boardMenu.add(new JSeparator());

    // Generate custom menus for all platforms
    Set<String> customMenusTitles = new LinkedHashSet<>();
    for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
        for (TargetPlatform targetPlatform : targetPackage.platforms()) {
            customMenusTitles.addAll(targetPlatform.getCustomMenus().values());
        }
    }
    for (String customMenuTitle : customMenusTitles) {
        JMenu customMenu = new JMenu(tr(customMenuTitle));
        customMenu.putClientProperty("removeOnWindowDeactivation", true);
        boardsCustomMenus.add(customMenu);
    }

    List<JMenuItem> menuItemsToClickAfterStartup = new LinkedList<>();

    ButtonGroup boardsButtonGroup = new ButtonGroup();
    Map<String, ButtonGroup> buttonGroupsMap = new HashMap<>();

    // Cycle through all packages
    boolean first = true;
    for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
        // For every package cycle through all platform
        for (TargetPlatform targetPlatform : targetPackage.platforms()) {

            // Add a separator from the previous platform
            if (!first)
                boardMenu.add(new JSeparator());
            first = false;

            // Add a title for each platform
            String platformLabel = targetPlatform.getPreferences().get("name");
            if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) {
                JMenuItem menuLabel = new JMenuItem(tr(platformLabel));
                menuLabel.setEnabled(false);
                boardMenu.add(menuLabel);
            }

            // Cycle through all boards of this platform
            for (TargetBoard board : targetPlatform.getBoards().values()) {
                if (board.getPreferences().get("hide") != null)
                    continue;
                JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, menuItemsToClickAfterStartup,
                        buttonGroupsMap, board, targetPlatform, targetPackage);
                boardMenu.add(item);
                boardsButtonGroup.add(item);
            }
        }
    }

    if (menuItemsToClickAfterStartup.isEmpty()) {
        menuItemsToClickAfterStartup.add(selectFirstEnabledMenuItem(boardMenu));
    }

    for (JMenuItem menuItemToClick : menuItemsToClickAfterStartup) {
        menuItemToClick.setSelected(true);
        menuItemToClick.getAction().actionPerformed(new ActionEvent(this, -1, ""));
    }
}

From source file:processing.app.Base.java

private JRadioButtonMenuItem createBoardMenusAndCustomMenus(final List<JMenu> boardsCustomMenus,
        List<JMenuItem> menuItemsToClickAfterStartup, Map<String, ButtonGroup> buttonGroupsMap,
        TargetBoard board, TargetPlatform targetPlatform, TargetPackage targetPackage) throws Exception {
    String selPackage = PreferencesData.get("target_package");
    String selPlatform = PreferencesData.get("target_platform");
    String selBoard = PreferencesData.get("board");

    String boardId = board.getId();
    String packageName = targetPackage.getId();
    String platformName = targetPlatform.getId();

    // Setup a menu item for the current board
    @SuppressWarnings("serial")
    Action action = new AbstractAction(board.getName()) {
        public void actionPerformed(ActionEvent actionevent) {
            BaseNoGui.selectBoard((TargetBoard) getValue("b"));
            filterVisibilityOfSubsequentBoardMenus(boardsCustomMenus, (TargetBoard) getValue("b"), 1);

            onBoardOrPortChange();//w  ww  .j a  v  a 2  s  .co m
            rebuildImportMenu(Editor.importMenu);
            rebuildExamplesMenu(Editor.examplesMenu);
        }
    };
    action.putValue("b", board);

    JRadioButtonMenuItem item = new JRadioButtonMenuItem(action);

    if (selBoard.equals(boardId) && selPackage.equals(packageName) && selPlatform.equals(platformName)) {
        menuItemsToClickAfterStartup.add(item);
    }

    PreferencesMap customMenus = targetPlatform.getCustomMenus();
    for (final String menuId : customMenus.keySet()) {
        String title = customMenus.get(menuId);
        JMenu menu = getBoardCustomMenu(tr(title));

        if (board.hasMenu(menuId)) {
            PreferencesMap boardCustomMenu = board.getMenuLabels(menuId);
            for (String customMenuOption : boardCustomMenu.keySet()) {
                @SuppressWarnings("serial")
                Action subAction = new AbstractAction(tr(boardCustomMenu.get(customMenuOption))) {
                    public void actionPerformed(ActionEvent e) {
                        PreferencesData.set("custom_" + menuId, ((TargetBoard) getValue("board")).getId() + "_"
                                + getValue("custom_menu_option"));
                        onBoardOrPortChange();
                    }
                };
                subAction.putValue("board", board);
                subAction.putValue("custom_menu_option", customMenuOption);

                if (!buttonGroupsMap.containsKey(menuId)) {
                    buttonGroupsMap.put(menuId, new ButtonGroup());
                }

                JRadioButtonMenuItem subItem = new JRadioButtonMenuItem(subAction);
                menu.add(subItem);
                buttonGroupsMap.get(menuId).add(subItem);

                String selectedCustomMenuEntry = PreferencesData.get("custom_" + menuId);
                if (selBoard.equals(boardId)
                        && (boardId + "_" + customMenuOption).equals(selectedCustomMenuEntry)) {
                    menuItemsToClickAfterStartup.add(subItem);
                }
            }
        }
    }

    return item;
}

From source file:processing.app.Base.java

public void rebuildProgrammerMenu() {
    programmerMenus = new LinkedList<>();

    ButtonGroup group = new ButtonGroup();
    for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
        for (TargetPlatform targetPlatform : targetPackage.platforms()) {
            for (String programmer : targetPlatform.getProgrammers().keySet()) {
                String id = targetPackage.getId() + ":" + programmer;

                @SuppressWarnings("serial")
                AbstractAction action = new AbstractAction(
                        targetPlatform.getProgrammer(programmer).get("name")) {
                    public void actionPerformed(ActionEvent actionevent) {
                        PreferencesData.set("programmer", "" + getValue("id"));
                    }/*  w ww  .j  a  v a  2s. co  m*/
                };
                action.putValue("id", id);
                JMenuItem item = new JRadioButtonMenuItem(action);
                if (PreferencesData.get("programmer").equals(id)) {
                    item.setSelected(true);
                }
                group.add(item);
                programmerMenus.add(item);
            }
        }
    }
}

From source file:psidev.psi.mi.filemakers.xmlMaker.gui.XsdTreePanelImpl.java

/**
 * create a button panel that includes buttons for loading the schema, to
 * associate a node to a flat file, a cell a default value or to specify
 * that a value should be automaticaly generated, to get informations about
 * the node, print the XML file or just have a preview of it.
 *//*from  w ww  .ja va2 s .c o m*/
public Box getButtonPanel() {
    // associationLabel.setEditable(false);

    Box buttonsPanel = new Box(BoxLayout.Y_AXIS);

    JPanel treeBox = new JPanel();//
    treeBox.setLayout(new BoxLayout(treeBox, BoxLayout.Y_AXIS));// (BoxLayout.Y_AXIS);

    // Box mappingBox = new Box(BoxLayout.Y_AXIS);
    // mappingBox.setBorder(new TitledBorder("Mapping"));

    Box associationBox = new Box(BoxLayout.Y_AXIS);
    associationBox.setBorder(new TitledBorder("Associations"));

    Box nodeBox = new Box(BoxLayout.Y_AXIS);
    nodeBox.setBorder(new TitledBorder("Node"));

    Box outputBox = new Box(BoxLayout.Y_AXIS);
    outputBox.setBorder(new TitledBorder("Output"));

    /* add a button for loading a XML Schema */
    JButton loadFileb = new JButton("Open File");
    Utils.setDefaultSize(loadFileb);
    loadFileb.addActionListener(new LoadSchemaListener());

    JButton loadURLb = new JButton("Open URL");
    Utils.setDefaultSize(loadURLb);
    loadURLb.addActionListener(new LoadURLSchemaListener());

    JButton setIdb = new JButton("Prefix");
    Utils.setDefaultSize(setIdb);
    setIdb.addActionListener(new SetIdListener());

    /* add a button for duplicate a node (in case of lists) */
    JButton duplicateb = new JButton("Duplicate");
    Utils.setDefaultSize(duplicateb);
    duplicateb.addActionListener(new DuplicateListener());

    /* add a button for restauring original choice */
    JButton choiceb = new JButton("Restore");
    Utils.setDefaultSize(choiceb);
    choiceb.addActionListener(new OriginalNodeListener());

    JButton infosb = new JButton("About");
    Utils.setDefaultSize(infosb);
    infosb.addActionListener(new InfosListener());

    JButton checkb = new JButton("Check");
    Utils.setDefaultSize(checkb);
    checkb.addActionListener(new CheckListener());

    JButton previewb = new JButton("Preview");
    Utils.setDefaultSize(previewb);
    previewb.addActionListener(new PreviewListener());

    JButton printb = new JButton("Make XML");
    Utils.setDefaultSize(printb);
    printb.addActionListener(new PrintListener());

    treeBox.add(loadFileb);
    treeBox.add(loadURLb);
    treeBox.add(setIdb);
    treeBox.add(checkb);
    treeBox.setBorder(new TitledBorder("Schema"));

    nodeBox.add(duplicateb);
    nodeBox.add(choiceb);
    nodeBox.add(infosb);

    outputBox.add(previewb);
    outputBox.add(printb);

    associationButtons = new ButtonGroup();

    fieldAssociation = new JRadioButton("to field");
    duplicableFieldAssociation = new JRadioButton("to duplicable field");
    dictionnaryAssociation = new JRadioButton("to dictionnary");
    defaultAssociation = new JRadioButton("to default value");
    autoGenerationAssociationButton = new JRadioButton("to automatic value");
    flatFileAssociation = new JRadioButton("to flat file");

    associationButtons.add(flatFileAssociation);
    associationButtons.add(duplicableFieldAssociation);
    associationButtons.add(fieldAssociation);
    associationButtons.add(dictionnaryAssociation);
    associationButtons.add(defaultAssociation);
    associationButtons.add(autoGenerationAssociationButton);
    associationButtons.setSelected(flatFileAssociation.getModel(), true);

    JButton genericAssociationb = new JButton("Associate");
    Utils.setDefaultSize(genericAssociationb);
    genericAssociationb.addActionListener(new GenericAssociationListener());

    JButton genericCancelAssociationb = new JButton("Cancel");
    Utils.setDefaultSize(genericCancelAssociationb);
    genericCancelAssociationb.addActionListener(new GenericCancelAssociationListener());

    associationBox.add(flatFileAssociation);

    associationBox.add(duplicableFieldAssociation);

    associationBox.add(fieldAssociation);
    JButton editFieldb = new JButton("validation");
    Utils.setDefaultSize(editFieldb);
    editFieldb.addActionListener(new EditFieldAssociationListener());
    associationBox.add(editFieldb);
    associationBox.add(dictionnaryAssociation);
    associationBox.add(defaultAssociation);
    associationBox.add(defaultAssociation);
    associationBox.add(autoGenerationAssociationButton);

    associationBox.add(genericAssociationb);
    associationBox.add(genericCancelAssociationb);

    buttonsPanel.add(treeBox);
    buttonsPanel.add(associationBox);
    buttonsPanel.add(nodeBox);
    buttonsPanel.add(outputBox);
    // lineBox2.add(lineBox2);
    // buttonsPanel.add(lineBox3);
    return buttonsPanel;
}