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:com.mirth.connect.plugins.httpauth.HttpAuthConnectorPropertiesPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    typeLabel = new JLabel("Authentication Type:");
    typeLabel.setHorizontalAlignment(SwingConstants.RIGHT);

    typeComboBox = new MirthComboBox();
    typeComboBox.setModel(new DefaultComboBoxModel<AuthType>(AuthType.values()));
    typeComboBox.addActionListener(new ActionListener() {
        @Override/*from   w w  w .jav a 2 s.  co m*/
        public void actionPerformed(ActionEvent evt) {
            authTypeChanged();
        }
    });
    typeComboBox.setToolTipText("Select the type of HTTP authentication to perform for incoming requests.");

    basicRealmLabel = new JLabel("Realm:");
    basicRealmField = new MirthTextField();
    basicRealmField.setToolTipText("The protection space for this server.");
    basicCredentialsLabel = new JLabel("Credentials:");

    basicCredentialsPanel = new JPanel();
    basicCredentialsPanel.setBackground(getBackground());

    basicCredentialsTable = new MirthTable();
    basicCredentialsTable.setModel(new RefreshTableModel(new String[] { "Username", "Password" }, 0));
    basicCredentialsTable.setCustomEditorControls(true);
    basicCredentialsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    basicCredentialsTable.setRowSelectionAllowed(true);
    basicCredentialsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    basicCredentialsTable.setDragEnabled(false);
    basicCredentialsTable.setOpaque(true);
    basicCredentialsTable.setSortable(false);
    basicCredentialsTable.getTableHeader().setReorderingAllowed(false);
    basicCredentialsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    basicCredentialsTable.setToolTipText(
            "<html>Username and password pairs to authenticate<br/>users with. At least one pair is required.</html>");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        basicCredentialsTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor basicCredentialsTableCellEditor = new CredentialsTableCellEditor(
            basicCredentialsTable);
    basicCredentialsTable.getColumnExt(0).setCellEditor(basicCredentialsTableCellEditor);
    basicCredentialsTable.getColumnExt(0).setToolTipText("The username to authenticate with.");
    basicCredentialsTable.getColumnExt(1).setCellRenderer(new PasswordCellRenderer());
    basicCredentialsTable.getColumnExt(1).setCellEditor(new DefaultCellEditor(new JPasswordField()));
    basicCredentialsTable.getColumnExt(1).setToolTipText("The password to authenticate with.");

    basicCredentialsTableScrollPane = new JScrollPane(basicCredentialsTable);

    basicCredentialsNewButton = new MirthButton("New");
    basicCredentialsNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String username;
            boolean found;
            do {
                num++;
                username = "user" + num;

                found = false;
                for (int row = 0; row < basicCredentialsTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(username,
                            (String) basicCredentialsTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) basicCredentialsTable.getModel()).addRow(new String[] { username, "" });
            basicCredentialsTable.setRowSelectionInterval(basicCredentialsTable.getRowCount() - 1,
                    basicCredentialsTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    basicCredentialsDeleteButton = new MirthButton("Delete");
    basicCredentialsDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(basicCredentialsTable);
            if (selectedRow >= 0) {
                if (basicCredentialsTable.isEditing()) {
                    basicCredentialsTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) basicCredentialsTable.getModel()).removeRow(selectedRow);

                int rowCount = basicCredentialsTable.getRowCount();
                if (selectedRow < rowCount) {
                    basicCredentialsTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    basicCredentialsTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    basicCredentialsTableCellEditor.setDeleteButton(basicCredentialsDeleteButton);

    digestRealmLabel = new JLabel("Realm:");
    digestRealmField = new MirthTextField();
    digestRealmField.setToolTipText("The protection space for this server.");

    digestAlgorithmLabel = new JLabel("Algorithms:");
    ButtonGroup digestAlgorithmButtonGroup = new ButtonGroup();
    String toolTipText = "<html>Specifies the digest algorithms supported by this server.<br/><b>&nbsp;- MD5:</b> The security data A1 will contain the username, realm, and password.<br/><b>&nbsp;- MD5-sess:</b> The security data A1 will also contain the server and client nonces.</html>";

    digestAlgorithmMD5Radio = new MirthRadioButton(Algorithm.MD5.toString());
    digestAlgorithmMD5Radio.setBackground(getBackground());
    digestAlgorithmMD5Radio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmMD5Radio);

    digestAlgorithmMD5SessRadio = new MirthRadioButton(Algorithm.MD5_SESS.toString());
    digestAlgorithmMD5SessRadio.setBackground(getBackground());
    digestAlgorithmMD5SessRadio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmMD5SessRadio);

    digestAlgorithmBothRadio = new MirthRadioButton("Both");
    digestAlgorithmBothRadio.setBackground(getBackground());
    digestAlgorithmBothRadio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmBothRadio);

    digestQOPLabel = new JLabel("QOP Modes:");
    toolTipText = "<html>The quality of protection modes to support.<br/><b>&nbsp;- auth:</b> Regular auth with client nonce and count in the digest.<br/><b>&nbsp;- auth-int:</b> Same as auth, but also with message integrity protection enabled.</html>";

    digestQOPAuthCheckBox = new MirthCheckBox(QOPMode.AUTH.toString());
    digestQOPAuthCheckBox.setBackground(getBackground());
    digestQOPAuthCheckBox.setToolTipText(toolTipText);

    digestQOPAuthIntCheckBox = new MirthCheckBox(QOPMode.AUTH_INT.toString());
    digestQOPAuthIntCheckBox.setBackground(getBackground());
    digestQOPAuthIntCheckBox.setToolTipText(toolTipText);

    digestOpaqueLabel = new JLabel("Opaque:");
    digestOpaqueField = new MirthTextField();
    digestOpaqueField.setToolTipText("A string of data that should be returned by the client unchanged.");
    digestCredentialsLabel = new JLabel("Credentials:");

    digestCredentialsPanel = new JPanel();
    digestCredentialsPanel.setBackground(getBackground());

    digestCredentialsTable = new MirthTable();
    digestCredentialsTable.setModel(new RefreshTableModel(new String[] { "Username", "Password" }, 0));
    digestCredentialsTable.setCustomEditorControls(true);
    digestCredentialsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    digestCredentialsTable.setRowSelectionAllowed(true);
    digestCredentialsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    digestCredentialsTable.setDragEnabled(false);
    digestCredentialsTable.setOpaque(true);
    digestCredentialsTable.setSortable(false);
    digestCredentialsTable.getTableHeader().setReorderingAllowed(false);
    digestCredentialsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    digestCredentialsTable.setToolTipText(
            "<html>Username and password pairs to authenticate<br/>users with. At least one pair is required.</html>");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        digestCredentialsTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor digestCredentialsTableCellEditor = new CredentialsTableCellEditor(
            digestCredentialsTable);
    digestCredentialsTable.getColumnExt(0).setCellEditor(digestCredentialsTableCellEditor);
    digestCredentialsTable.getColumnExt(0).setToolTipText("The username to authenticate with.");
    digestCredentialsTable.getColumnExt(1).setCellRenderer(new PasswordCellRenderer());
    digestCredentialsTable.getColumnExt(1).setCellEditor(new DefaultCellEditor(new JPasswordField()));
    digestCredentialsTable.getColumnExt(1).setToolTipText("The password to authenticate with.");

    digestCredentialsTableScrollPane = new JScrollPane(digestCredentialsTable);

    digestCredentialsNewButton = new MirthButton("New");
    digestCredentialsNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String username;
            boolean found;
            do {
                num++;
                username = "user" + num;

                found = false;
                for (int row = 0; row < digestCredentialsTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(username,
                            (String) digestCredentialsTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) digestCredentialsTable.getModel()).addRow(new String[] { username, "" });
            digestCredentialsTable.setRowSelectionInterval(digestCredentialsTable.getRowCount() - 1,
                    digestCredentialsTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    digestCredentialsDeleteButton = new MirthButton("Delete");
    digestCredentialsDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(digestCredentialsTable);
            if (selectedRow >= 0) {
                if (digestCredentialsTable.isEditing()) {
                    digestCredentialsTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) digestCredentialsTable.getModel()).removeRow(selectedRow);

                int rowCount = digestCredentialsTable.getRowCount();
                if (selectedRow < rowCount) {
                    digestCredentialsTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    digestCredentialsTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    digestCredentialsTableCellEditor.setDeleteButton(digestCredentialsDeleteButton);

    jsScriptLabel = new JLabel("Script:");
    jsScriptField = new JTextField();
    jsScriptField.setEditable(false);
    jsScriptField.setBackground(getBackground());
    jsScriptField.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    jsScriptField.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            JavaScriptHttpAuthDialog dialog = new JavaScriptHttpAuthDialog(PlatformUI.MIRTH_FRAME, jsScript);
            if (dialog.wasSaved()) {
                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
                jsScript = dialog.getScript();
                updateJSScriptField();
            }
        }
    });
    jsScriptField.setToolTipText(
            "<html>Click here to open the JavaScript editor dialog.<br/>The return value of this script is used to accept or reject requests.</html>");

    customClassNameLabel = new JLabel("Class Name:");
    customClassNameField = new MirthTextField();
    customClassNameField
            .setToolTipText("The fully-qualified Java class name of the Authenticator class to use.");
    customPropertiesLabel = new JLabel("Properties:");

    customPropertiesPanel = new JPanel();
    customPropertiesPanel.setBackground(getBackground());

    customPropertiesTable = new MirthTable();
    customPropertiesTable.setModel(new RefreshTableModel(new String[] { "Name", "Value" }, 0));
    customPropertiesTable.setCustomEditorControls(true);
    customPropertiesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    customPropertiesTable.setRowSelectionAllowed(true);
    customPropertiesTable.setRowHeight(UIConstants.ROW_HEIGHT);
    customPropertiesTable.setDragEnabled(false);
    customPropertiesTable.setOpaque(true);
    customPropertiesTable.setSortable(false);
    customPropertiesTable.getTableHeader().setReorderingAllowed(false);
    customPropertiesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    customPropertiesTable.setToolTipText(
            "Optional properties to pass into the Authenticator class when it is instantiated.");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        customPropertiesTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor customPropertiesTableCellEditor = new CredentialsTableCellEditor(
            customPropertiesTable);
    customPropertiesTable.getColumnExt(0).setCellEditor(customPropertiesTableCellEditor);
    customPropertiesTable.getColumnExt(0).setToolTipText("The name of the property to include.");
    customPropertiesTable.getColumnExt(1).setToolTipText("The value of the property to include.");

    customPropertiesTableScrollPane = new JScrollPane(customPropertiesTable);

    customPropertiesNewButton = new MirthButton("New");
    customPropertiesNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String name;
            boolean found;
            do {
                num++;
                name = "Property " + num;

                found = false;
                for (int row = 0; row < customPropertiesTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(name,
                            (String) customPropertiesTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) customPropertiesTable.getModel()).addRow(new String[] { name, "" });
            customPropertiesTable.setRowSelectionInterval(customPropertiesTable.getRowCount() - 1,
                    customPropertiesTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    customPropertiesDeleteButton = new MirthButton("Delete");
    customPropertiesDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(customPropertiesTable);
            if (selectedRow >= 0) {
                if (customPropertiesTable.isEditing()) {
                    customPropertiesTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) customPropertiesTable.getModel()).removeRow(selectedRow);

                int rowCount = customPropertiesTable.getRowCount();
                if (selectedRow < rowCount) {
                    customPropertiesTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    customPropertiesTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    customPropertiesTableCellEditor.setDeleteButton(customPropertiesDeleteButton);

    oauth2TokenLabel = new JLabel("Access Token Location:");

    oauth2TokenLocationComboBox = new MirthComboBox();
    oauth2TokenLocationComboBox.setModel(new DefaultComboBoxModel<TokenLocation>(TokenLocation.values()));
    oauth2TokenLocationComboBox
            .setToolTipText("Determines where the access token is located in client requests.");

    oauth2TokenField = new MirthTextField();
    oauth2TokenField
            .setToolTipText("The header or query parameter to pass along with the verification request.");

    oauth2VerificationURLLabel = new JLabel("Verification URL:");
    oauth2VerificationURLField = new MirthTextField();
    oauth2VerificationURLField.setToolTipText(
            "<html>The HTTP URL to perform a GET request to for access<br/>token verification. If the response code is >= 400,<br/>the authentication attempt is rejected by the server.</html>");

    for (ConnectorPropertiesPlugin connectorPropertiesPlugin : LoadedExtensions.getInstance()
            .getConnectorPropertiesPlugins().values()) {
        if (connectorPropertiesPlugin
                .isConnectorPropertiesPluginSupported(HttpAuthConnectorPluginProperties.PLUGIN_POINT)) {
            connectorPropertiesPanel = connectorPropertiesPlugin.getConnectorPropertiesPanel();
        }
    }
}

From source file:com.pianobakery.complsa.MainGui.java

public MainGui() {

    $$$setupUI$$$();/*from  w w w . jav  a 2  s .c  om*/
    runtimeParameters();
    trainCorp = new HashMap<String, File>();
    trainSentModels = new HashMap<String, File>();
    indexFilesModel = new HashMap<String, File>();
    searchCorpusModel = new HashMap<String, File>();
    selDocdirContent = new ArrayList<File>();
    langModelsText.setText("None");
    posIndRadiusTextField.setEnabled(false);
    //Disable all Components as long as wDir is not set.
    enableUIElements(false);

    ButtonGroup selSearchGroup = new ButtonGroup();
    selSearchGroup.add(searchSearchCorpRadioButton);
    selSearchGroup.add(searchTopCorpRadioButton);

    ButtonGroup searchSelGroup = new ButtonGroup();
    searchSelGroup.add(selTextRadioButton);
    searchSelGroup.add(selDocRadioButton);

    //licenseKeyGUI = new LicenseKeyGUI(frame, true);

    //Added to get the docSearchTable the focus when opening the Reader without selecting something so up down button will work
    frame.addWindowFocusListener(new WindowAdapter() {
        public void windowGainedFocus(WindowEvent e) {
            docSearchResTable.requestFocusInWindow();
        }
    });

    frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
            .put(KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "CTRL + S");
    frame.getRootPane().getActionMap().put("CTRL + S", runSearch());

    frame.addWindowListener(new WindowAdapter() {
        public void windowOpened(WindowEvent evt) {
            formWindowOpened(evt);
        }
    });

    //Needs to get a white background in the termtableview (only in windows)
    termTablePane.getViewport().setBackground(Color.WHITE);

    //Project Page
    //Project Folder
    newFolderButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            newFolderMethod();

        }
    });

    selectFolderButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectFolderMethod();

        }
    });

    //Download Language Models
    downloadModelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            downloadModelMethod();

        }
    });

    //Add-Remove Topic Corpus
    addTopicCorpusButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addTopicCorpusMethod();

        }
    });

    selectTrainCorp.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            frame.setTitle("Selected Training Corpus: " + selectTrainCorp.getSelectedItem() + " and "
                    + "Sel. Search Corpus: " + searchCorpComboBox.getSelectedItem());
            algTextField.setText("Knowledge Corpus: " + selectTrainCorp.getSelectedItem());

            try {
                updateIndexFileFolder();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });

    removeTopicCorpusButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) throws ArrayIndexOutOfBoundsException {
            removeTopicCorpusMethod();

        }

    });

    //Update and remove Index
    updateIndexButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateIndexMethod();

        }
    });

    removeIndexButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeIndexMethod();

        }
    });

    //Train Semantic
    trainCorpButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            trainCorpMethod();

        }
    });

    indexTypeComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            if (indexTypeComboBox.getSelectedIndex() == 2) {
                logger.debug("Enable indexType Combo with Index: " + indexTypeComboBox.getSelectedIndex());

                posIndRadiusTextField.setEnabled(true);
                return;
            }
            logger.debug("Disable indexType Combo with Index: " + indexTypeComboBox.getSelectedIndex());
            posIndRadiusTextField.setEnabled(false);

        }
    });

    //Import and remove Search Corpora
    impSearchCorpButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            impSearchCorpMethod();

        }
    });

    searchCorpComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            frame.setTitle("Selected Training Corpus: " + selectTrainCorp.getSelectedItem() + " and "
                    + "Sel. Search Corpus: " + searchCorpComboBox.getSelectedItem());
        }
    });

    removeSearchCorpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) throws ArrayIndexOutOfBoundsException {
            removeSearchCorpMethod();

        }

    });

    //Search Page
    //Choose Index Type
    selectIndexTypeComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            if (searchModelList.isEmpty()) {
                return;
            }

            if (searchModelList.get(selectIndexTypeComboBox.getSelectedItem()) == null) {
                return;
            }

            List<String> theList = searchModelList.get(selectIndexTypeComboBox.getSelectedItem().toString());
            selectTermweightComboBox.removeAllItems();
            for (String aTFItem : theList) {
                selectTermweightComboBox.addItem(aTFItem);
            }

            getSelectedSearchModelFiles();

        }
    });

    selectTermweightComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            if (searchModelList.isEmpty()) {
                return;
            }

            if (searchModelList.get(selectIndexTypeComboBox.getSelectedItem()) == null) {
                return;
            }
            getSelectedSearchModelFiles();
        }
    });

    //Select Search Type
    selTextRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectDocumentButton.setEnabled(false);
            searchTextArea.setEnabled(true);
            //searchDocValue.setText("nothing selected");

        }
    });

    selDocRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectDocumentButton.setEnabled(true);
            searchTextArea.setText(null);
            searchTextArea.setEnabled(false);

        }
    });

    selectDocumentButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            importSearchFile();
            openSearchDocumentButton.setEnabled(true);

        }
    });

    openSearchDocumentButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (searchDocReader == null) {
                searchDocReader = getReaderLater(null, maingui);
                searchDocReader.setSearchTerms(getSelectedTermTableWords());
            } else if (!searchDocReader.getFrameVisible()) {
                searchDocReader.setFrameVisible(true);
                searchDocReader.setSearchTerms(getSelectedTermTableWords());
            }
            searchDocReader.setDocumentText(searchFileString);
            searchDocReader.setSelFullDocLabel(searchDocValue.toString());
            searchDocReader.setViewPane(2);
            searchDocReader.disableComponents();
            searchDocReader.setSearchTerms(getSelectedTermTableWords());

        }
    });

    //Search Button
    searchButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            searchMethod();

        }

    });

    //Table Listeners
    docSearchResTable.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent me) {
            JTable table = (JTable) me.getSource();
            Point p = me.getPoint();
            int row = docSearchResTable.rowAtPoint(p);
            if (docSearchResModel == null || docSearchResModel.getRowCount() == 0
                    || docSearchResModel.getDocFile(0).getFileName().equals(emptyTable)) {
                return;
            }

            switch (me.getClickCount()) {
            case 1:
                if (row == -1) {
                    break;
                }
                if (docSearchResTable.getRowCount() > 0) {
                    logger.debug("Single click Doc: " + ((DocSearchModel) docSearchResTable.getModel())
                            .getDocSearchFile(row).getFile().toString());
                    fillMetaDataField(
                            ((DocSearchModel) docSearchResTable.getModel()).getDocSearchFile(row).getFile());
                    if (reader != null) {
                        reader.setSearchTerms(getSelectedTermTableWords());
                    }
                    if (searchDocReader != null) {
                        searchDocReader.setSearchTerms(getSelectedTermTableWords());
                    }
                    setSelReaderContent();
                    setDocReaderContent(0);
                    if (reader != null) {
                        reader.setSearchTerms(getSelectedTermTableWords());
                    }
                    if (searchDocReader != null) {
                        searchDocReader.setSearchTerms(getSelectedTermTableWords());
                    }

                }
                break;
            case 2:
                if (row == -1) {
                    break;
                }
                if (docSearchResTable.getRowCount() > 0) {
                    logger.debug("Double click Doc: " + ((DocSearchModel) docSearchResTable.getModel())
                            .getDocSearchFile(row).getFile().toString());
                    fillMetaDataField(
                            ((DocSearchModel) docSearchResTable.getModel()).getDocSearchFile(row).getFile());

                    if (reader == null) {
                        reader = getReaderLater((DocSearchModel) docSearchResTable.getModel(), maingui);
                        reader.setSearchTerms(getSelectedTermTableWords());
                    } else if (!reader.getFrameVisible()) {
                        reader.setFrameVisible(true);
                        reader.setSearchTerms(getSelectedTermTableWords());
                    }
                    setSelReaderContent();
                    setDocReaderContent(0);
                    if (reader != null) {
                        reader.setSearchTerms(getSelectedTermTableWords());
                    }
                    if (searchDocReader != null) {
                        searchDocReader.setSearchTerms(getSelectedTermTableWords());
                    }
                }
                break;
            }

        }
    });

    termSearchResTable.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent me) {
            JTable table = (JTable) me.getSource();
            Point p = me.getPoint();
            int row = docSearchResTable.rowAtPoint(p);
            if (termSearchResTable.getModel() == null || termSearchResTable.getRowCount() == 0
                    || termSearchResTable.getModel().getValueAt(row, 1).equals(emptyTable)) {
                return;
            }
            switch (me.getClickCount()) {
            case 1:
                logger.debug("Single click Term: " + termSearchResTable.getModel().getValueAt(row, 1));
                logger.debug("Selected Terms: " + Arrays.toString(getSelectedTermTableWords()));
                if (reader != null) {
                    reader.setSearchTerms(getSelectedTermTableWords());

                }
                if (searchDocReader != null) {
                    searchDocReader.setSearchTerms(getSelectedTermTableWords());
                }
                break;
            case 2:
                logger.debug("Double click Term: " + termSearchResTable.getModel().getValueAt(row, 1));
                if (reader != null) {
                    reader.setSearchTerms(getSelectedTermTableWords());
                }
                if (searchDocReader != null) {
                    searchDocReader.setSearchTerms(getSelectedTermTableWords());
                }
                break;

            }

        }
    });

    docSearchResTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent event) {
            if (docSearchResModel == null || docSearchResModel.getRowCount() == 0
                    || docSearchResModel.getDocFile(0).getFileName().equals(emptyTable)) {
                return;
            }
            if (docSearchResTable.getSelectedRow() > -1) {
                // print first column value from selected row
                logger.debug("KeyboardSelection: " + ((DocSearchModel) docSearchResTable.getModel())
                        .getDocSearchFile(
                                docSearchResTable.convertRowIndexToModel(docSearchResTable.getSelectedRow()))
                        .getFile().toString());
                fillMetaDataField(((DocSearchModel) docSearchResTable.getModel())
                        .getDocSearchFile(
                                docSearchResTable.convertRowIndexToModel(docSearchResTable.getSelectedRow()))
                        .getFile());
                setSelReaderContent();
                setDocReaderContent(0);
                if (reader != null) {
                    reader.setSearchTerms(getSelectedTermTableWords());
                }
                if (searchDocReader != null) {
                    searchDocReader.setSearchTerms(getSelectedTermTableWords());
                }

            }
        }
    });

    termSearchResTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (termSearchResTable.getModel() == null || termSearchResTable.getRowCount() == 0
                    || termSearchResTable.getModel().getValueAt(0, 1).equals(emptyTable)) {
                return;
            }
            if (termSearchResTable.getSelectedRow() > -1) {
                // print first column value from selected row
                if (reader != null) {
                    reader.setSearchTerms(getSelectedTermTableWords());
                }
                if (searchDocReader != null) {
                    searchDocReader.setSearchTerms(getSelectedTermTableWords());
                }

            }

        }
    });

}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initToolBar() {
    toolbar = new JToolBar("ToolBar", JToolBar.HORIZONTAL);

    // Add Button
    addButton = new JButton();
    addButton.setActionCommand("");
    addButton.setToolTipText("");
    addButton.setIcon(new ImageIcon(getClass().getResource("edit-add-3.png")));

    // Search date range radio buttons
    ButtonGroup group = new ButtonGroup();
    yearToggleButton = new JToggleButton();
    yearToggleButton.setToolTipText("");
    yearToggleButton.setIcon(new ImageIcon(getClass().getResource("year-s.png")));
    group.add(yearToggleButton);//www  .  ja  v  a2  s .com
    monthToggleButton = new JToggleButton();
    monthToggleButton.setToolTipText("");
    monthToggleButton.setIcon(new ImageIcon(getClass().getResource("month-s.png")));
    group.add(monthToggleButton);
    dayToggleButton = new JToggleButton();
    dayToggleButton.setToolTipText("");
    dayToggleButton.setIcon(new ImageIcon(getClass().getResource("day-s.png")));
    group.add(dayToggleButton);
    customToggleButton = new JToggleButton();
    customToggleButton.setToolTipText("");
    customToggleButton.setIcon(new ImageIcon(getClass().getResource("all-s.png")));
    group.add(customToggleButton);

    // ??Checkbox
    monthToggleButton.setSelected(true);

    Calendar earliestCalendar = Calendar.getInstance();
    earliestCalendar.add(Calendar.YEAR, -100);
    java.util.Date earliestDate = earliestCalendar.getTime();

    Calendar latestCalendar = Calendar.getInstance();
    latestCalendar.add(Calendar.YEAR, 100);
    java.util.Date latestDate = latestCalendar.getTime();
    // 3?
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.MONTH, -1);
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    java.util.Date initDate = calendar.getTime();

    SpinnerDateModel startDateModel = new SpinnerDateModel(DateUtil.getStartOfWeek(), earliestDate, latestDate,
            Calendar.MONTH);
    startDateSpinner = new JSpinner(startDateModel);
    JSpinner.DateEditor startDateEditor = new JSpinner.DateEditor(startDateSpinner, "yyyy-MM-dd");
    startDateSpinner.setEditor(startDateEditor);

    calendar.add(Calendar.MONTH, 1);
    calendar.add(Calendar.DAY_OF_MONTH, -1);
    initDate = calendar.getTime();
    SpinnerDateModel endDateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.MONTH);
    endDateSpinner = new JSpinner(endDateModel);
    JSpinner.DateEditor endDateEditor = new JSpinner.DateEditor(endDateSpinner, "yyyy-MM-dd");
    endDateSpinner.setEditor(endDateEditor);

    // Keyword text field
    keywordTextField = new JTextField();
    keywordTextField.setPreferredSize(new Dimension(250, 20));
    keywordTextField.setMaximumSize(keywordTextField.getPreferredSize());

    // Search Button
    searchButton = new JButton();
    searchButton.setActionCommand("?");
    searchButton.setToolTipText("?");
    searchButton.setIcon(new ImageIcon(getClass().getResource("edit-find-5.png")));

    // Layout
    cards = new JPanel();
    cards.setLayout(new CardLayout());
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());

    startDateSpinner.setPreferredSize(new Dimension(90, 20));
    startDateSpinner.setMaximumSize(startDateSpinner.getPreferredSize());
    box.add(startDateSpinner);

    box.add(Box.createHorizontalStrut(6));

    endDateSpinner.setPreferredSize(new Dimension(90, 20));
    endDateSpinner.setMaximumSize(endDateSpinner.getPreferredSize());
    box.add(endDateSpinner);

    cards.add(new JPanel(), HIDE_DATE_CHOOSER);
    cards.add(box, SHOW_DATE_CHOOSER);

    Box dateRangeBox = Box.createHorizontalBox();
    dateRangeBox.add(Box.createHorizontalGlue());
    dateRangeBox.add(cards);

    toolbar.add(addButton);
    toolbar.add(dateRangeBox);
    toolbar.add(customToggleButton);
    toolbar.add(yearToggleButton);
    toolbar.add(monthToggleButton);
    toolbar.add(dayToggleButton);
    toolbar.add(keywordTextField);
    toolbar.add(searchButton);

    add(toolbar, BorderLayout.NORTH);

    // Event listener
    addButton.addActionListener(e -> showAddRecordDialog());

    ActionListener listener = e -> searchRecords();
    yearToggleButton.addActionListener(listener);
    monthToggleButton.addActionListener(listener);
    dayToggleButton.addActionListener(listener);
    customToggleButton.addActionListener(listener);
    keywordTextField.addActionListener(listener);
    searchButton.addActionListener(listener);

    customToggleButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                chooseDateRange();
            }
        }
    });
}

From source file:org.pentaho.support.standalone.SDSupportUtility.java

/**
 * initializing UI/* www . java2  s . c  om*/
 * 
 * @throws Exception
 */
public SDSupportUtility() throws Exception {

    prop = loadProperty();

    setResizable(false);
    setTitle(SDConstant.PENT_SUP_WIZARD);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 665, 516);

    contentPane = new JPanel();
    contentPane.setBackground(UIManager.getColor("Button.background"));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblLastAttached = new JLabel("Last Attached");
    lblLastAttached.setOpaque(false);
    lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT);
    lblLastAttached.setBounds(322, 335, 127, 23);
    contentPane.add(lblLastAttached);

    JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard");
    lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51));
    lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP);
    lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT);
    lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23));
    lblPentahoCustomerSupport.setBounds(130, 109, 506, 37);
    contentPane.add(lblPentahoCustomerSupport);

    JLabel lbllogo = new JLabel();
    lbllogo.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png")));
    lbllogo.setBounds(10, 11, 409, 93);
    contentPane.add(lbllogo);

    chckbxNewCheckBoxEnvironment = new JCheckBox("Environment");
    chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.ENVIRONMENT);
            } else {
                ArgList.remove(SDConstant.ENVIRONMENT);
            }
        }
    });
    chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23);
    contentPane.add(chckbxNewCheckBoxEnvironment);
    chckbxNewCheckBoxEnvironment.setOpaque(false);

    chckbxNewCheckBoxStructure = new JCheckBox("Structure Details");
    chckbxNewCheckBoxStructure.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.STRUCT);
            } else {
                ArgList.remove(SDConstant.STRUCT);
            }
        }
    });
    chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23);
    contentPane.add(chckbxNewCheckBoxStructure);
    chckbxNewCheckBoxStructure.setOpaque(false);

    chckbxLogs = new JCheckBox("Logs");
    chckbxLogs.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LOGS);
            } else {
                ArgList.remove(SDConstant.LOGS);
            }
        }
    });
    chckbxLogs.setBounds(377, 164, 248, 23);
    contentPane.add(chckbxLogs);
    chckbxLogs.setOpaque(false);

    chckbxGetSecureFiles = new JCheckBox("Secure Files");
    chckbxGetSecureFiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.SECURITY);
            } else {
                ArgList.remove(SDConstant.SECURITY);
            }
        }
    });
    chckbxGetSecureFiles.setBounds(109, 190, 243, 23);
    contentPane.add(chckbxGetSecureFiles);
    chckbxGetSecureFiles.setOpaque(false);

    chckbxMd5 = new JCheckBox("MD5 Hash Value");
    chckbxMd5.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.MD5);
            } else {
                ArgList.remove(SDConstant.MD5);
            }
        }
    });
    chckbxMd5.setBounds(109, 216, 243, 23);
    contentPane.add(chckbxMd5);
    chckbxMd5.setOpaque(false);

    chckbxDbdetails = new JCheckBox("Datasource Details");
    chckbxDbdetails.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.DATASOURCE);
            } else {
                ArgList.remove(SDConstant.DATASOURCE);
            }
        }
    });
    chckbxDbdetails.setBounds(109, 294, 243, 23);
    contentPane.add(chckbxDbdetails);
    chckbxDbdetails.setOpaque(false);

    chckbxLicense = new JCheckBox("License File");
    chckbxLicense.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LICENSE);
            } else {
                ArgList.remove(SDConstant.LICENSE);
            }
        }
    });
    chckbxLicense.setBounds(109, 164, 243, 23);
    contentPane.add(chckbxLicense);
    chckbxLicense.setOpaque(false);

    chckbxProcesslist = new JCheckBox("Running Process");
    chckbxProcesslist.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.RUNNING_TASK);
            } else {
                ArgList.remove(SDConstant.RUNNING_TASK);
            }
        }
    });
    chckbxProcesslist.setBounds(109, 242, 243, 23);
    contentPane.add(chckbxProcesslist);
    chckbxProcesslist.setOpaque(false);

    chckbxTomcatxml = new JCheckBox("XML files from Tomcat");
    chckbxTomcatxml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                tomcatXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                tomcatXml = false;
            }
        }
    });
    chckbxTomcatxml.setBounds(377, 242, 248, 23);
    contentPane.add(chckbxTomcatxml);
    chckbxTomcatxml.setOpaque(false);

    chckbxServerXml = new JCheckBox("XML files from Server");
    chckbxServerXml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverXml = false;
            }
        }
    });
    chckbxServerXml.setBounds(377, 216, 248, 23);
    contentPane.add(chckbxServerXml);
    chckbxServerXml.setOpaque(false);

    chckbxGetBatfiles = new JCheckBox("Start up files from server");
    chckbxGetBatfiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverBatFile = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverBatFile = false;
            }
        }
    });
    chckbxGetBatfiles.setBounds(377, 268, 248, 23);
    contentPane.add(chckbxGetBatfiles);
    chckbxGetBatfiles.setOpaque(false);

    chckbxServerproperties = new JCheckBox("Properites files from server");
    chckbxServerproperties.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverProrperties = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverProrperties = false;
            }
        }
    });
    chckbxServerproperties.setBounds(377, 294, 248, 23);
    contentPane.add(chckbxServerproperties);
    chckbxServerproperties.setOpaque(false);

    btnNewButton = new JButton("Package");
    btnNewButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {

            try {

                if (installType.equalsIgnoreCase("Manual")) {

                    if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                        JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                                JOptionPane.ERROR_MESSAGE);
                    } else {

                        WEB_XML = new StringBuilder();
                        WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator)
                                .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO)
                                .append(File.separator).append(SDConstant.WEB_INF).append(File.separator)
                                .append(SDConstant.WEB_XML);

                        PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString());
                        prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH);
                        prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH);
                    }

                }

                if (prop.getProperty(SDConstant.BI_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                disableAll();
                setBIServerPath(prop);
                final String data = textFieldBrowser.getText();
                if (!data.equalsIgnoreCase(null)) {
                    ArgList.add(SDConstant.BROWSER);
                }

                String[] array = new String[ArgList.size()];

                int count = 0;
                for (int i = 0; i < ArgList.size(); i++) {

                    String retName = ArgList.get(i);
                    if (retName.equals("file")) {
                        if (count == 0) {
                            array[i] = retName;
                            count++;
                        }
                    } else {
                        array[i] = retName;
                    }

                }

                ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME);

                factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory");
                ConfigRetreiver[] config = factory.getConfigRetrevier(array);

                ExecutorService service = Executors.newFixedThreadPool(10);

                for (final ConfigRetreiver configobj : config) {
                    if (null != configobj) {
                        configobj.setBISeverPath(prop);
                        configobj.setServerName("biserver");

                        if (installType.equalsIgnoreCase("Installer")) {
                            configobj.setInstallType("Installer");
                        } else if (installType.equalsIgnoreCase("Archive")) {
                            configobj.setInstallType("Archive");
                        } else if (installType.equalsIgnoreCase("Manual")) {
                            configobj.setInstallType("Manual");
                        }

                        if (configobj instanceof FileRetriever) {
                            configobj.setBidiXml(serverXml);
                            configobj.setBidiBatFile(serverBatFile);
                            configobj.setBidiProrperties(serverProrperties);
                            configobj.setTomcatXml(tomcatXml);
                        }
                        if (configobj instanceof BrowserInfoRetriever) {
                            configobj.setBrowserInfo(data);
                        }

                        service.execute(new Runnable() {
                            public void run() {
                                if (null != configobj)
                                    configobj.readAndSaveConfiguration(prop);
                            }
                        });
                    }
                }
                btnNewButton.setVisible(false);
                progressBar.setVisible(true);
                ProgressThread thread = new ProgressThread();
                thread.setSupport(getSupport());
                thread.setProp(prop);
                new Thread(thread).start();

                service.shutdown();
            } catch (Exception e1) {
                e1.printStackTrace();
            }

        }

    });

    chckbxSelectAll = new JCheckBox("Select/ De-select");
    chckbxSelectAll.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectAll();
            } else {
                deSelectAll();
            }
        }
    });

    chckbxSelectAll.setBounds(46, 138, 201, 23);
    chckbxSelectAll.setOpaque(false);
    contentPane.add(chckbxSelectAll);
    btnNewButton.setForeground(SystemColor.infoText);
    btnNewButton.setBounds(10, 430, 639, 37);
    contentPane.add(btnNewButton);
    chckbxServerproperties.setOpaque(false);

    JLabel lblAttach = new JLabel("Attach Artifact");
    lblAttach.setHorizontalAlignment(SwingConstants.LEFT);
    lblAttach.setBounds(32, 335, 177, 23);
    contentPane.add(lblAttach);
    lblAttach.setOpaque(false);

    JButton btnNewButtonBrowse = new JButton("Browse");
    btnNewButtonBrowse.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            saveSelectedFile(prop);

            JFrame parentFrame = new JFrame();
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("Specify a file to save");
            fileChooser.setMultiSelectionEnabled(true);

            int userSelection = fileChooser.showSaveDialog(parentFrame);

            if (userSelection == JFileChooser.APPROVE_OPTION) {
                fileToSave = fileChooser.getSelectedFiles();
                for (int i = 0; i < fileToSave.length; i++) {
                    File file = fileToSave[i];
                    String artifactpath = file.getAbsolutePath();

                    File f = new File(artifactpath);
                    String absolutefilename = f.getName();
                    String filename = ArtifactsDirectory.concat(absolutefilename);
                    CopyFile artifactcopy = new CopyFile(artifactpath, filename);
                    try {
                        artifactcopy.copy();
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                }
                uploadedFiles();

                rowList = new JList(model);
                listScrollPane.setViewportView(rowList);
                panel.add(listScrollPane);

            }
            rowList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lblDelete.setVisible(true);
                }
            });

        }
    });
    btnNewButtonBrowse.setBounds(208, 335, 104, 23);
    contentPane.add(btnNewButtonBrowse);
    btnNewButtonBrowse.setOpaque(false);

    textFieldBrowser = new JTextField();
    textFieldBrowser.setBounds(208, 364, 441, 23);
    contentPane.add(textFieldBrowser);
    textFieldBrowser.setColumns(10);

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(8, 437, 639, 24);
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
    contentPane.add(progressBar);

    JLabel lblBrowserInformation = new JLabel("Browser Information");
    lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT);
    lblBrowserInformation.setLabelFor(textFieldBrowser);
    lblBrowserInformation.setBounds(32, 368, 174, 14);
    contentPane.add(lblBrowserInformation);

    panel = new JPanel();
    panel.setBounds(423, 325, 127, 33);
    contentPane.add(panel);
    panel.setLayout(null);

    listScrollPane = new JScrollPane();
    listScrollPane.setBounds(0, 0, 127, 33);
    panel.add(listScrollPane);

    lblDelete = new JLabel("");
    lblDelete.setBounds(552, 325, 22, 23);
    lblDelete.setVisible(false);
    lblDelete.setIcon(
            new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png")));
    contentPane.add(lblDelete);
    lblDelete.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?");
            if (option == JOptionPane.YES_OPTION) {
                String sel = rowList.getSelectedValue().toString();
                String selected = dir + "/" + sel;
                File fileExists = new File(selected);
                fileExists.delete();
                model.remove(sel.indexOf(sel));
                lblDelete.setVisible(false);

            }
        }
    });

    JLabel instalType = new JLabel("Installation Type : ");
    instalType.setBounds(32, 395, 177, 23);
    instalType.setVisible(true);
    contentPane.add(instalType);

    ButtonGroup btnGrp = new ButtonGroup();

    rdbtnInstaller = new JRadioButton("Installer");
    rdbtnInstaller.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Installer";
        }
    });
    rdbtnInstaller.setBounds(208, 395, 104, 23);
    rdbtnInstaller.setSelected(true);
    contentPane.add(rdbtnInstaller);
    btnGrp.add(rdbtnInstaller);

    rdbtnArchive = new JRadioButton("Archive");
    rdbtnArchive.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Archive";
        }
    });
    rdbtnArchive.setBounds(333, 395, 104, 23);
    contentPane.add(rdbtnArchive);
    btnGrp.add(rdbtnArchive);

    rdbtnManual = new JRadioButton("Manual");
    rdbtnManual.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Manual";
        }
    });
    rdbtnManual.setBounds(460, 395, 127, 27);
    contentPane.add(rdbtnManual);
    btnGrp.add(rdbtnManual);

    JLabel lblBackground = new JLabel();
    lblBackground.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg")));
    lblBackground.setBackground(SystemColor.controlHighlight);
    lblBackground.setHorizontalAlignment(SwingConstants.CENTER);
    lblBackground.setBounds(0, 0, 659, 488);
    contentPane.add(lblBackground);
}

From source file:kr.ac.kaist.swrc.jhannanum.demo.GUIDemo.java

/**
 * Returns the panel for the work flow.//from w ww.j a  v a  2  s.c om
 * 
 * @return the panel for the work flow
 */
private JComponent createWorkflow() {
    JPanel workflowPanel = new JPanel(new GridLayout(1, 3));

    listModelMajor2 = new DefaultListModel();
    listModelMajor3 = new DefaultListModel();
    listModelSupplement1 = new DefaultListModel();
    listModelSupplement2 = new DefaultListModel();
    listModelSupplement3 = new DefaultListModel();

    listPluginMajor2 = new JList(listModelMajor2);
    listPluginMajor3 = new JList(listModelMajor3);
    listPluginSupplement1 = new JList(listModelSupplement1);
    listPluginSupplement2 = new JList(listModelSupplement2);
    listPluginSupplement3 = new JList(listModelSupplement3);

    // phase1
    JPanel phasePanel = new JPanel(new GridLayout(1, 1));
    phasePanel.setBorder(BorderFactory.createTitledBorder("Phase1. Plain Text Processing"));
    JPanel listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Supplement Plug-in"));
    JScrollPane scroll = new JScrollPane();
    scroll.setViewportView(listPluginSupplement1);
    listPanel.add(scroll);
    phasePanel.add(listPanel);
    workflowPanel.add(phasePanel);

    // phase2
    phasePanel = new JPanel(new GridLayout(1, 2));
    phasePanel.setBorder(BorderFactory.createTitledBorder("Phase2. Morphological Analysis"));
    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Major Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginMajor2);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Supplement Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginSupplement2);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    workflowPanel.add(phasePanel);

    // phase3
    phasePanel = new JPanel(new GridLayout(1, 2));
    phasePanel.setBorder(BorderFactory.createTitledBorder("Phase3. Part Of Speech Tagging"));
    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Major Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginMajor3);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Supplement Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginSupplement3);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    workflowPanel.add(phasePanel);

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

    JPanel controlPanel = new JPanel(new GridLayout(4, 1));
    controlPanel.setBorder(BorderFactory.createTitledBorder("Workflow Control"));
    buttonActivate = new JButton("Activate the workflow");
    buttonAnalysis = new JButton("Analyze Text");
    buttonReset = new JButton("Close the workflow");

    JPanel threadPanel = new JPanel(new GridLayout(1, 1));
    radioMultiThread = new JRadioButton("Mutli-thread Mode", true);
    radioSingleThread = new JRadioButton("Single-thread Mode", false);
    threadPanel.setBorder(BorderFactory.createTitledBorder("Thread Mode"));
    threadPanel.add(radioMultiThread);
    threadPanel.add(radioSingleThread);
    ButtonGroup groupThread = new ButtonGroup();
    groupThread.add(radioMultiThread);
    groupThread.add(radioSingleThread);

    controlPanel.add(threadPanel);
    controlPanel.add(buttonActivate);
    controlPanel.add(buttonAnalysis);
    controlPanel.add(buttonReset);

    buttonAnalysis.setEnabled(false);
    buttonReset.setEnabled(false);

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

    JPanel pluginInfoPanel = new JPanel(new GridLayout(1, 1));
    pluginInfoPanel.setBorder(BorderFactory.createTitledBorder("Plug-in Information"));
    areaPluginInfo = new JTextArea();
    areaPluginInfo.setLineWrap(true);
    scroll = new JScrollPane();
    scroll.setViewportView(areaPluginInfo);
    pluginInfoPanel.add(scroll);

    JPanel infoPanel = new JPanel(new GridLayout(1, 2));
    infoPanel.add(pluginInfoPanel);
    infoPanel.add(controlPanel);

    JPanel panel = new JPanel(new GridLayout(2, 1));
    workflowPanel.setBorder(BorderFactory.createTitledBorder("HanNanum Workflow"));
    panel.add(workflowPanel);
    panel.add(infoPanel);

    return panel;
}

From source file:it.isislab.dmason.util.SystemManagement.Master.thrower.DMasonMaster.java

private void initComponents() {
    menuBar1 = new JMenuBar();
    jMenuFile = new JMenu();
    //menuItemOpen = new JMenuItem();
    menuItemExit = new JMenuItem();
    jMenuAbout = new JMenu();
    menuItemInfo = new JMenuItem();
    menuItemHelp = new JMenuItem();
    panelMain = new JPanel();
    jPanelContainerConnection = new JPanel();
    jPanelConnection = new JPanel();
    jLabelAddress = new JLabel();
    textFieldAddress = new JTextField();
    jLabelPort = new JLabel();
    textFieldPort = new JTextField();
    refreshServerLabel = new JLabel();
    buttonRefreshServerLabel = new JButton();
    jPanelContainerSettings = new JPanel();
    jPanelSetDistribution = new JPanel();
    jPanelSettings = new JPanel();
    jLabelHorizontal = new JLabel();
    jLabelSquare = new JLabel();
    jLabelMaxDistance = new JLabel();
    jLabelWidth = new JLabel();
    jLabelInsertSteps = new JLabel();
    textFieldMaxDistance = new JTextField();
    textFieldWidth = new JTextField();
    jLabelHeight = new JLabel();
    textFieldHeight = new JTextField();
    jLabelAgents = new JLabel();
    textFieldAgents = new JTextField();
    textFieldColumns = new JTextField();
    textFieldRows = new JTextField();
    textFieldSteps = new JTextField();
    jLabelChooseSimulation = new JLabel();
    jComboBoxChooseSimulation = new JComboBox();
    jComboBoxNumRegionXPeer = new JComboBox();
    jPanelContainerTabbedPane = new JPanel();
    tabbedPane2 = new JTabbedPane();
    jPanelDefault = new JPanel();
    jPanelSimulation = new ModelPanel(tabbedPane2);
    labelSimulationConfigSet = new JLabel();
    labelRegionsResume = new JLabel();
    labelNumOfPeerResume = new JLabel();
    labelRegForPeerResume = new JLabel();
    labelWriteReg = new JLabel();
    labelWriteNumOfPeer = new JLabel();
    labelWriteRegForPeer = new JLabel();
    labelWidthRegion = new JLabel();
    labelheightRegion = new JLabel();
    labelDistrMode = new JLabel();
    labelWriteRegWidth = new JLabel();
    labelWriteRegHeight = new JLabel();
    labelWriteDistrMode = new JLabel();
    graphicONcheckBox2 = new JCheckBox();
    jPanelSetButton = new JPanel();
    buttonSetConfigDefault = new JButton();
    jPanelAdvanced = new JPanel();
    jPanelAdvancedMain = new JPanel();
    peerInfoStatus = new JDesktopPane();
    internalFrame1 = new JInternalFrame();
    architectureLabel = new JTextArea();
    architectureLabel.setBackground(Color.BLACK);
    architectureLabel.setForeground(Color.GREEN);
    architectureLabel.setEditable(false);
    advancedConfirmBut = new JLabel();
    graphicONcheckBox = new JCheckBox();
    jCheckBoxLoadBalancing = new JCheckBox("Load Balancing", false);
    jCheckBoxLoadBalancing.setEnabled(true);
    jCheckBoxLoadBalancing.setSelected(false);

    jCheckBoxMPI = new JCheckBox("Enable MPI", false);
    jCheckBoxMPI.setEnabled(true);//from ww w.  ja v a2  s .c  o m
    jCheckBoxMPI.setSelected(false);

    scrollPaneTree = new JScrollPane();
    tree1 = new JTree();
    buttonSetConfigAdvanced = new JButton();
    jLabelPlayButton = new JLabel();
    jLabelPauseButton = new JLabel();
    jPanelNumStep = new JPanel();
    jLabelStep = new JLabel();
    jLabelStep.setHorizontalAlignment(SwingConstants.LEFT);
    jLabelStopButton = new JLabel();
    scrollPane1 = new JScrollPane();
    peerInfoStatus1 = new JDesktopPane();
    root = new DefaultMutableTreeNode("Simulation");
    ButtonGroup b = new ButtonGroup();
    ip = textFieldAddress.getText();
    port = textFieldPort.getText();
    menuBar1 = new JMenuBar();
    jMenuFile = new JMenu();
    menuItemExit = new JMenuItem();
    menuNewSim = new JMenuItem();
    jMenuAbout = new JMenu();
    menuItemInfo = new JMenuItem();
    menuItemHelp = new JMenuItem();
    scrollPane3 = new JScrollPane();
    scrollPane4 = new JScrollPane();
    notifyArea = new JTextArea();
    panelConsole = new JPanel();
    buttonSetConfigDefault2 = new JButton();
    jPanelSetButton2 = new JPanel();
    graphicONcheckBox = new JCheckBox();
    graphicONcheckBox.setEnabled(false);
    graphicONcheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            withGui = graphicONcheckBox.isSelected();
        }
    });

    jLabelChooseSimulation = new JLabel();
    jComboBoxChooseSimulation = new JComboBox();

    loadSimulation();

    selectedSimulation = ((SimComboEntry) jComboBoxChooseSimulation.getSelectedItem()).fullSimName;
    jPanelSimulation.updateHTML(selectedSimulation);
    jComboBoxChooseSimulation.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            // Prevent executing listener's actions two times
            if (e.getStateChange() != ItemEvent.SELECTED)
                return;
            selectedSimulation = ((SimComboEntry) jComboBoxChooseSimulation.getSelectedItem()).fullSimName;
            jPanelSimulation.updateHTML(selectedSimulation);
            isThin = isThinSimulation(selectedSimulation);
            jCheckBoxLoadBalancing.setSelected(false);
            jCheckBoxLoadBalancing.setEnabled(!isThin);
            initializeDefaultLabel();
        }
    });

    /*for(int i=2;i<100;i++)
       jComboRegions.addItem(i);*/

    buttonRefreshServerLabel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            connect();
        }
    });

    refreshServerLabel.addMouseListener(new MouseListener() {

        @Override
        public void mouseReleased(MouseEvent arg0) {
            if (starter.isConnected())
                starter.execute("restart");
            else
                JOptionPane.showMessageDialog(null, "Not connected to the Server!");
        }

        @Override
        public void mousePressed(MouseEvent arg0) {
        }

        @Override
        public void mouseExited(MouseEvent arg0) {
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {
        }

        @Override
        public void mouseClicked(MouseEvent arg0) {
        }
    });

    jCheckBoxLoadBalancing.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (!isHorizontal) {
                if (jCheckBoxLoadBalancing.isSelected())
                    labelWriteDistrMode.setText("SQUARE BALANCED MODE");
                else
                    labelWriteDistrMode.setText("SQUARE MODE");
            }

            if (isHorizontal) {
                if (jCheckBoxLoadBalancing.isSelected())
                    labelWriteDistrMode.setText("HORIZONTAL BALANCED MODE");
                else
                    labelWriteDistrMode.setText("HORIZONTAL MODE");
            }

        }
    });

    buttonSetConfigDefault2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (initializeDefaultLabel())
                submitCustomizeMode();
            else
                JOptionPane.showMessageDialog(null, "To start a simulation must fill in all fields...!");
        }
    });

    buttonSetConfigDefault.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (initializeDefaultLabel())
                submitDefaultMode();
            else
                JOptionPane.showMessageDialog(null, "To start a simulation must fill in all fields...!");
        }
    });

    advancedConfirmBut.addMouseListener(new MouseListener() {

        @Override
        public void mouseReleased(MouseEvent arg0) {
            confirm();
            res -= (Integer) jComboBoxNumRegionXPeer.getSelectedItem();

            withGui = graphicONcheckBox.isSelected();

            jComboBoxNumRegionXPeer.removeAllItems();
            graphicONcheckBox.setSelected(false);
            for (int i = 1; i <= res; i++)
                jComboBoxNumRegionXPeer.addItem(i);

            JOptionPane.showMessageDialog(null, "Region assigned !");

        }

        @Override
        public void mousePressed(MouseEvent arg0) {
        }

        @Override
        public void mouseExited(MouseEvent arg0) {
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {
        }

        @Override
        public void mouseClicked(MouseEvent arg0) {
        }
    });

    //======== this ========

    Container contentPane = getContentPane();

    //======== menuBar1 ========
    {
        {
            jMenuFile.setText("    File    ");

            menuNewSim.setText("New    ");
            menuNewSim.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    me.dispose();
                    me = null;
                    DMasonMaster p = new DMasonMaster();
                    p.setVisible(true);
                }
            });

            jMenuFile.add(menuNewSim);

            //---- menuItemExit ----
            menuItemExit.setText("Exit");
            menuItemExit.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    me.dispose();
                }
            });

            jMenuFile.add(menuItemExit);
        }
        menuBar1.add(jMenuFile);
        menuBar1.add(getJMenuSystem());

        //======== jMenuAbout ========
        {
            jMenuAbout.setText(" ?  ");

            //---- menuItemInfo ----
            menuItemInfo.setText("Info");
            menuItemInfo.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(null, Release.PRODUCT_RELEASE, "Info", 1);

                }
            });

            jMenuAbout.add(menuItemInfo);

            //---- menuItenHelp ----
            menuItemHelp.setText("Help");
            menuItemHelp.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent arg0) {
                    try {
                        java.net.URI uri = new java.net.URI(
                                "http://isis.dia.unisa.it/projects/it.isislab.dmason/");
                        try {
                            java.awt.Desktop.getDesktop().browse(uri);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }

                }
            });

            jMenuAbout.add(menuItemHelp);

        }
        menuBar1.add(jMenuAbout);
    }

    setJMenuBar(menuBar1);

    //======== panelMain ========
    {

        //======== jPanelContainerConnection ========
        {

            //======== jPanelConnection ========
            {
                jPanelConnection.setBorder(new TitledBorder("Connection"));
                jPanelConnection.setPreferredSize(new Dimension(215, 125));

                //---- jLabelAddress ----
                jLabelAddress.setText("IP Address :");

                //---- textFieldAddress ----
                textFieldAddress.setText("127.0.0.1");

                //---- jLabelPort ----
                jLabelPort.setText("Port :");

                //---- textFieldPort ----
                textFieldPort.setText("61616");

                //---- refreshServerLabel ----

                refreshServerLabel.setIcon(new ImageIcon("resources/image/refresh.png"));

                //---- buttonRefreshServerLabel ----
                buttonRefreshServerLabel.setText("OK");

                JLabel lblStatus = new JLabel("Communication Server status :");

                lblStatusIcon = new JLabel("");
                lblStatusIcon.setIcon(new ImageIcon("resources/image/status-down.png"));

                buttonActiveMQRestart = new JButton("");
                buttonActiveMQRestart.setEnabled(false);
                buttonActiveMQRestart.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent arg0) {

                        notifyArea.append("ActiveMQ restarting...\n");
                        if (csManager.restartActiveMQ())
                            notifyArea.append("ActiveMQ restarted!\n");

                        checkCommunicationServerStatus();

                    }
                });
                buttonActiveMQRestart.setMinimumSize(new Dimension(24, 24));
                buttonActiveMQRestart.setMaximumSize(new Dimension(24, 24));
                buttonActiveMQRestart.setPreferredSize(new Dimension(24, 24));
                buttonActiveMQRestart.setIcon(new ImageIcon("resources/image/LH2 - Restart.png"));

                buttonActiveMQStart = new JButton("");
                buttonActiveMQStart.setEnabled(false);
                buttonActiveMQStart.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent arg0) {
                        notifyArea.append("ActiveMQ starting...\n");
                        if (csManager.startActiveMQ())
                            notifyArea.append("ActiveMQ started!\n");

                        checkCommunicationServerStatus();
                    }
                });
                buttonActiveMQStart.setPreferredSize(new Dimension(24, 24));
                buttonActiveMQStart.setMinimumSize(new Dimension(24, 24));
                buttonActiveMQStart.setMaximumSize(new Dimension(24, 24));
                buttonActiveMQStart.setIcon(new ImageIcon("resources/image/LH2 - Shutdown.png"));

                buttonActiveMQStop = new JButton("");
                buttonActiveMQStop.setEnabled(false);
                buttonActiveMQStop.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent arg0) {
                        notifyArea.append("ActiveMQ stopping...\n");
                        if (csManager.stopActiveMQ())
                            notifyArea.append("ActiveMQ stopped!\n");

                        checkCommunicationServerStatus();
                    }
                });
                buttonActiveMQStop.setPreferredSize(new Dimension(24, 24));
                buttonActiveMQStop.setMinimumSize(new Dimension(24, 24));
                buttonActiveMQStop.setMaximumSize(new Dimension(24, 24));
                buttonActiveMQStop.setIcon(new ImageIcon("resources/image/LH2 - Stop.png"));

                btnCheckPeers = new JButton("Check Peers");
                btnCheckPeers.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            checkPeers();
                        } catch (Exception e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                        }
                    }
                });

                GroupLayout jPanelConnectionLayout = new GroupLayout(jPanelConnection);
                jPanelConnectionLayout.setHorizontalGroup(jPanelConnectionLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelConnectionLayout.createSequentialGroup().addGroup(jPanelConnectionLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.TRAILING)
                                                .addComponent(refreshServerLabel)
                                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                                        .addComponent(buttonActiveMQStart,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(buttonActiveMQRestart,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(buttonActiveMQStop,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addGap(111).addComponent(jLabelAddress).addGap(18)
                                                        .addComponent(textFieldAddress,
                                                                GroupLayout.PREFERRED_SIZE, 91,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18).addComponent(jLabelPort).addGap(18)
                                                        .addComponent(textFieldPort, GroupLayout.PREFERRED_SIZE,
                                                                85, GroupLayout.PREFERRED_SIZE)
                                                        .addGap(46).addComponent(buttonRefreshServerLabel)))
                                        .addGap(51).addComponent(btnCheckPeers))
                                .addGroup(jPanelConnectionLayout.createSequentialGroup().addComponent(lblStatus)
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addComponent(lblStatusIcon)))
                                .addContainerGap(71, Short.MAX_VALUE)));
                jPanelConnectionLayout.setVerticalGroup(jPanelConnectionLayout
                        .createParallelGroup(Alignment.TRAILING)
                        .addGroup(jPanelConnectionLayout.createSequentialGroup().addGroup(jPanelConnectionLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(lblStatus).addComponent(lblStatusIcon))
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(buttonActiveMQRestart, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                                .addComponent(buttonActiveMQStart, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                                .addComponent(buttonActiveMQStop, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(ComponentPlacement.RELATED, 1, Short.MAX_VALUE))
                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                        .addContainerGap(18, Short.MAX_VALUE).addComponent(refreshServerLabel)
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.BASELINE)
                                                .addComponent(buttonRefreshServerLabel).addComponent(jLabelPort)
                                                .addComponent(textFieldPort, GroupLayout.PREFERRED_SIZE, 22,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabelAddress)
                                                .addComponent(textFieldAddress, GroupLayout.PREFERRED_SIZE, 22,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addComponent(btnCheckPeers))))
                                .addGap(10)));
                jPanelConnectionLayout.linkSize(SwingConstants.HORIZONTAL,
                        new Component[] { buttonActiveMQRestart, buttonActiveMQStart, buttonActiveMQStop });
                jPanelConnection.setLayout(jPanelConnectionLayout);
            }

            GroupLayout jPanelContainerConnectionLayout = new GroupLayout(jPanelContainerConnection);
            jPanelContainerConnection.setLayout(jPanelContainerConnectionLayout);
            jPanelContainerConnectionLayout
                    .setHorizontalGroup(jPanelContainerConnectionLayout.createParallelGroup()
                            .addGroup(jPanelContainerConnectionLayout
                                    .createSequentialGroup().addContainerGap().addComponent(jPanelConnection,
                                            GroupLayout.PREFERRED_SIZE, 829, GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(153, Short.MAX_VALUE)));
            jPanelContainerConnectionLayout.setVerticalGroup(
                    jPanelContainerConnectionLayout.createParallelGroup().addComponent(jPanelConnection,
                            GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE));
        }

        //======== jPanelContainerSettings ========
        {

            GroupLayout jPanelContainerSettingsLayout = new GroupLayout(jPanelContainerSettings);
            jPanelContainerSettings.setLayout(jPanelContainerSettingsLayout);
            jPanelContainerSettingsLayout.setHorizontalGroup(
                    jPanelContainerSettingsLayout.createParallelGroup().addGap(0, 1, Short.MAX_VALUE));
            jPanelContainerSettingsLayout.setVerticalGroup(
                    jPanelContainerSettingsLayout.createParallelGroup().addGap(0, 481, Short.MAX_VALUE));
        }

        //======== jPanelSetDistribution ========
        {
            jPanelSetDistribution.setBorder(new TitledBorder("Settings"));

            //======== jPanelSettings ========
            {

                //jLabelHorizontal.setIcon(new ImageIcon("it.isislab.dmason/resources/image/hori.png")));

                //---- jLabelSquare ----
                //jLabelSquare.setIcon(new ImageIcon("it.isislab.dmason/resources/image/square.png")));

                //---- jLabelMaxDistance ----
                jLabelMaxDistance.setText("MAX_DISTANCE :");

                //---- jLabelWidth ----
                jLabelWidth.setText("WIDTH :");

                //---- jLabelInsertSteps ----
                jLabelInsertSteps.setText("STEPS :");

                //---- textFieldMaxDistance ----
                textFieldMaxDistance.setText("1");

                //---- textFieldWidth ----
                textFieldWidth.setText("200");

                //---- jLabelHeight ----
                jLabelHeight.setText("HEIGHT :");

                //---- textFieldHeight ----
                textFieldHeight.setText("200");

                //---- jLabelAgents ----
                jLabelAgents.setText("AGENTS :");

                //---- textFieldAgents ----
                textFieldAgents.setText("15");

                //---- textFieldSteps
                textFieldSteps.setText("100");

                MouseListener textFieldMouseListener = new MouseListener() {

                    @Override
                    public void mouseReleased(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void mousePressed(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void mouseExited(MouseEvent e) {
                        initializeDefaultLabel();
                    }

                    @Override
                    public void mouseEntered(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void mouseClicked(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }
                };

                textFieldAgents.addMouseListener(textFieldMouseListener);
                textFieldAgents.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldAgents.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldColumns.addMouseListener(textFieldMouseListener);
                textFieldColumns.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        // TODO Auto-generated method stub
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldColumns.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                        // TODO Auto-generated method stub
                    }
                });

                textFieldMaxDistance.addMouseListener(textFieldMouseListener);
                textFieldMaxDistance.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldMaxDistance.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldWidth.addMouseListener(textFieldMouseListener);
                textFieldWidth.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldWidth.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldRows.addMouseListener(textFieldMouseListener);
                textFieldRows.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldRows.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {

                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldHeight.addMouseListener(textFieldMouseListener);
                textFieldHeight.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldHeight.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent arg0) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent arg0) {
                    }
                });

                textFieldSteps.addMouseListener(textFieldMouseListener);
                textFieldSteps.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldSteps.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                        // TODO Auto-generated method stub

                    }
                });

                //---- jLabelChooseSimulation ----
                jLabelChooseSimulation.setText("Choose your simulation:");

                //---- jComboBoxChooseSimulation ----
                jComboBoxChooseSimulation.setMaximumRowCount(10);

                JLabel lblRows = new JLabel("ROWS :");

                JLabel lblColumns = new JLabel("COLUMNS :");

                textFieldRows.setText("1");
                textFieldRows.setEnabled(false);
                textFieldRows.setColumns(10);

                rows = Integer.parseInt(textFieldRows.getText());

                textFieldColumns.setText("2");
                textFieldColumns.setEnabled(false);
                textFieldColumns.setColumns(10);
                columns = Integer.parseInt(textFieldColumns.getText());

                textFieldSteps.setText("100");
                textFieldSteps.setEnabled(false);
                textFieldSteps.setColumns(10);
                steps = 100;

                GroupLayout jPanelSettingsLayout = new GroupLayout(jPanelSettings);
                jPanelSettingsLayout.setHorizontalGroup(jPanelSettingsLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelSettingsLayout.createSequentialGroup().addGap(17)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.LEADING)
                                        .addComponent(jLabelChooseSimulation, GroupLayout.PREFERRED_SIZE, 245,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanelSettingsLayout.createSequentialGroup().addGap(119)
                                                .addComponent(jLabelHorizontal))
                                        .addComponent(jComboBoxChooseSimulation, GroupLayout.PREFERRED_SIZE,
                                                214, GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanelSettingsLayout.createSequentialGroup()
                                                .addGroup(jPanelSettingsLayout
                                                        .createParallelGroup(Alignment.TRAILING)
                                                        .addGroup(Alignment.LEADING, jPanelSettingsLayout
                                                                .createSequentialGroup()
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(lblRows,
                                                                                GroupLayout.PREFERRED_SIZE, 59,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(lblColumns))
                                                                .addGap(60)
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(jLabelSquare)
                                                                        .addComponent(textFieldColumns,
                                                                                GroupLayout.DEFAULT_SIZE, 94,
                                                                                Short.MAX_VALUE)
                                                                        .addComponent(textFieldRows,
                                                                                GroupLayout.DEFAULT_SIZE, 94,
                                                                                Short.MAX_VALUE)))
                                                        .addGroup(Alignment.LEADING, jPanelSettingsLayout
                                                                .createSequentialGroup()
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(jLabelMaxDistance)
                                                                        .addComponent(jLabelWidth)
                                                                        .addComponent(jLabelHeight)
                                                                        .addComponent(jLabelAgents)
                                                                        .addComponent(jLabelInsertSteps)
                                                                        .addGap(132))
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(textFieldAgents,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldHeight,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldWidth,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldMaxDistance,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldSteps,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addGap(20))))

                                                .addGap(20)))));
                jPanelSettingsLayout.setVerticalGroup(jPanelSettingsLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelSettingsLayout.createSequentialGroup().addContainerGap()
                                .addComponent(jLabelHorizontal).addGap(41)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.LEADING)
                                        .addComponent(jLabelSquare)
                                        .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                                .addComponent(lblRows, GroupLayout.PREFERRED_SIZE, 22,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addComponent(textFieldRows, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(textFieldColumns, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addComponent(lblColumns))
                                .addGap(18)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelMaxDistance).addComponent(textFieldMaxDistance,
                                                GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(ComponentPlacement.RELATED)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelWidth, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textFieldWidth, GroupLayout.PREFERRED_SIZE, 19,
                                                GroupLayout.PREFERRED_SIZE))
                                .addGap(10)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelHeight, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textFieldHeight, GroupLayout.PREFERRED_SIZE, 19,
                                                GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(ComponentPlacement.RELATED)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelAgents).addComponent(textFieldAgents,
                                                GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(ComponentPlacement.RELATED)
                                //.addGap(10)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelInsertSteps, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textFieldSteps, GroupLayout.PREFERRED_SIZE, 19,
                                                GroupLayout.PREFERRED_SIZE))
                                .addGap(35).addComponent(jLabelChooseSimulation)
                                .addPreferredGap(ComponentPlacement.UNRELATED)
                                .addComponent(jComboBoxChooseSimulation, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addGap(52)));
                jPanelSettings.setLayout(jPanelSettingsLayout);
            }

            //======== jPanelContainerTabbedPane ========
            {

                //======== tabbedPane2 ========
                {

                    //======== jPanelDefault ========
                    {
                        jPanelDefault.setBorder(new EtchedBorder());
                        jPanelDefault.setPreferredSize(new Dimension(350, 331));

                        //---- labelSimulationConfigSet ----
                        labelSimulationConfigSet.setText("Simulation Configuration Settings");
                        labelSimulationConfigSet.setFont(labelSimulationConfigSet.getFont().deriveFont(
                                labelSimulationConfigSet.getFont().getStyle() | Font.BOLD,
                                labelSimulationConfigSet.getFont().getSize() + 8f));

                        //---- labelRegionsResume ----
                        labelRegionsResume.setText("REGIONS :");

                        //---- labelNumOfPeerResume ----
                        labelNumOfPeerResume.setText("NUMBER OF PEERS :");

                        //---- labelRegForPeerResume ----
                        labelRegForPeerResume.setText("REGIONS FOR PEER :");

                        //---- labelWriteReg ----
                        labelWriteReg.setText("text");

                        //---- labelWriteNumOfPeer ----
                        labelWriteNumOfPeer.setText("text");

                        //---- labelWriteRegForPeer ----
                        labelWriteRegForPeer.setText("text");

                        //---- labelWidthRegion ----
                        labelWidthRegion.setText("REGION WIDTH :");

                        //---- labelheightRegion ----
                        labelheightRegion.setText("REGION HEIGHT :");

                        //---- labelDistrMode ----
                        labelDistrMode.setText("DISTRIBUTION MODE :");

                        //---- labelWriteRegWidth ----
                        labelWriteRegWidth.setText("text");

                        //---- labelWriteRegHeight ----
                        labelWriteRegHeight.setText("text");

                        //---- labelWriteDistrMode ----
                        labelWriteDistrMode.setText("text");

                        //---- graphicONcheckBox2 ----
                        graphicONcheckBox2.setText("Graphic ON");

                        //======== jPanelSetButton ========
                        {

                            //---- buttonSetConfigDefault ----
                            buttonSetConfigDefault.setText("Set");
                            {
                                jCheckBoxLoadBalancing.setText("Load Balancing");
                            }

                            GroupLayout jPanelSetButtonLayout = new GroupLayout(jPanelSetButton);
                            jPanelSetButton.setLayout(jPanelSetButtonLayout);
                            jPanelSetButtonLayout.setVerticalGroup(jPanelSetButtonLayout.createSequentialGroup()

                                    .addGroup(jPanelSetButtonLayout.createParallelGroup().addGroup(
                                            GroupLayout.Alignment.TRAILING,
                                            jPanelSetButtonLayout.createSequentialGroup().addComponent(
                                                    jCheckBoxMPI, GroupLayout.PREFERRED_SIZE, 20,
                                                    GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(jPanelSetButtonLayout.createParallelGroup()
                                            .addGroup(GroupLayout.Alignment.LEADING,
                                                    jPanelSetButtonLayout.createSequentialGroup().addComponent(
                                                            jCheckBoxLoadBalancing, GroupLayout.PREFERRED_SIZE,
                                                            20, GroupLayout.PREFERRED_SIZE))
                                            .addGroup(GroupLayout.Alignment.LEADING, jPanelSetButtonLayout
                                                    .createSequentialGroup()
                                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0,
                                                            Short.MAX_VALUE)
                                                    .addComponent(buttonSetConfigDefault,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.PREFERRED_SIZE)))

                                    .addContainerGap());

                            jPanelSetButtonLayout.setHorizontalGroup(jPanelSetButtonLayout
                                    .createSequentialGroup()
                                    .addComponent(jCheckBoxMPI, GroupLayout.PREFERRED_SIZE, 120,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(0, 0)
                                    .addComponent(jCheckBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 114,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 150, Short.MAX_VALUE).addComponent(buttonSetConfigDefault,
                                            GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(0, 0));

                            FlowLayout lsetbutt = new FlowLayout();
                            lsetbutt.addLayoutComponent("", jCheckBoxMPI);
                            lsetbutt.addLayoutComponent("", jCheckBoxLoadBalancing);
                            lsetbutt.addLayoutComponent("", buttonSetConfigDefault);
                            jPanelSetButton.setLayout(lsetbutt);

                        }

                        GroupLayout jPanelDefaultLayout = new GroupLayout(jPanelDefault);
                        jPanelDefaultLayout.setHorizontalGroup(jPanelDefaultLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelDefaultLayout.createSequentialGroup().addContainerGap()
                                        .addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(labelSimulationConfigSet,
                                                        GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                                                .addGroup(jPanelDefaultLayout.createSequentialGroup().addGap(6)
                                                        .addGroup(jPanelDefaultLayout
                                                                .createParallelGroup(Alignment.LEADING)
                                                                .addGroup(jPanelDefaultLayout
                                                                        .createSequentialGroup()
                                                                        .addGroup(jPanelDefaultLayout
                                                                                .createParallelGroup(
                                                                                        Alignment.LEADING)
                                                                                .addComponent(
                                                                                        labelNumOfPeerResume)
                                                                                .addComponent(
                                                                                        labelRegForPeerResume)
                                                                                .addComponent(labelWidthRegion)
                                                                                .addComponent(labelheightRegion)
                                                                                .addComponent(labelDistrMode)
                                                                                .addComponent(
                                                                                        labelRegionsResume))
                                                                        .addPreferredGap(
                                                                                ComponentPlacement.RELATED, 218,
                                                                                Short.MAX_VALUE)
                                                                        .addGroup(jPanelDefaultLayout
                                                                                .createParallelGroup(
                                                                                        Alignment.LEADING)
                                                                                .addComponent(
                                                                                        labelWriteNumOfPeer,
                                                                                        GroupLayout.PREFERRED_SIZE,
                                                                                        25,
                                                                                        GroupLayout.PREFERRED_SIZE)
                                                                                .addComponent(labelWriteReg)
                                                                                .addComponent(
                                                                                        labelWriteRegForPeer)
                                                                                .addComponent(
                                                                                        labelWriteRegWidth)
                                                                                .addComponent(
                                                                                        labelWriteRegHeight)
                                                                                .addComponent(
                                                                                        labelWriteDistrMode))
                                                                        .addGap(118))
                                                                .addComponent(graphicONcheckBox2))))
                                        .addGap(211))
                                .addGroup(jPanelDefaultLayout.createSequentialGroup()
                                        .addComponent(jPanelSetButton, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addContainerGap(23, Short.MAX_VALUE)));
                        jPanelDefaultLayout.setVerticalGroup(jPanelDefaultLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelDefaultLayout.createSequentialGroup().addContainerGap()
                                        .addComponent(labelSimulationConfigSet, GroupLayout.PREFERRED_SIZE, 31,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGap(28)
                                        .addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.TRAILING)
                                                .addGroup(jPanelDefaultLayout.createSequentialGroup()
                                                        .addComponent(labelRegionsResume)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelNumOfPeerResume)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelRegForPeerResume).addGap(6)
                                                        .addComponent(labelWidthRegion).addGap(6)
                                                        .addComponent(labelheightRegion)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelDistrMode))
                                                .addGroup(jPanelDefaultLayout.createSequentialGroup()
                                                        .addComponent(labelWriteReg)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelWriteNumOfPeer)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelWriteRegForPeer).addGap(6)
                                                        .addComponent(labelWriteRegWidth).addGap(6)
                                                        .addComponent(labelWriteRegHeight)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelWriteDistrMode,
                                                                GroupLayout.PREFERRED_SIZE, 16,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addGap(8)))
                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                        .addComponent(graphicONcheckBox2)
                                        .addPreferredGap(ComponentPlacement.RELATED, 82, Short.MAX_VALUE)
                                        .addComponent(jPanelSetButton, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
                        jPanelDefault.setLayout(jPanelDefaultLayout);
                    }
                    tabbedPane2.addTab("Default", jPanelDefault);

                    //======== jPanelSimulation ========

                    tabbedPane2.addTab("Simulation", jPanelSimulation);
                    //======== End jPanelSimulation ========
                    //======== jPanelAdvanced ========
                    {
                        jPanelAdvanced.setBorder(new EtchedBorder());

                        //======== jPanelAdvancedMain ========
                        {

                            //======== scrollPaneTree ========
                            {

                                //---- tree1 ----
                                tree1.setModel(new DefaultTreeModel(root));
                                DefaultTreeCellRenderer render = new DefaultTreeCellRenderer();

                                render.setOpenIcon(new ImageIcon("resources/image/network.png"));

                                render.setLeafIcon(new ImageIcon("esource/image/computer.gif"));

                                render.setClosedIcon(new ImageIcon("resources/image/network.png"));
                                tree1.setCellRenderer(render);
                                tree1.setRowHeight(25);
                                scrollPaneTree.setViewportView(tree1);
                                tree1.addTreeSelectionListener(new TreeSelectionListener() {

                                    @Override
                                    public void valueChanged(TreeSelectionEvent arg0) {
                                        if (arg0.getPath().getLastPathComponent().equals(root)) {
                                            jComboBoxNumRegionXPeer.setEnabled(true);
                                            advancedConfirmBut.setEnabled(true);
                                            graphicONcheckBox.setEnabled(true);
                                            total = Integer.parseInt(textFieldRows.getText())
                                                    * Integer.parseInt(textFieldColumns.getText()); //(Integer)jComboRegions.getSelectedItem();
                                            res = total;
                                            jComboBoxNumRegionXPeer.removeAllItems();
                                            for (int i = 1; i < res; i++)
                                                jComboBoxNumRegionXPeer.addItem(i);
                                        } else
                                            clickTreeListener();
                                    }
                                });

                            }

                            //======== peerInfoStatus ========
                            {
                                peerInfoStatus.setBorder(new TitledBorder("Settings"));
                                peerInfoStatus.setBackground(Color.lightGray);

                                //======== peerInfoStatus1 ========
                                {
                                    peerInfoStatus1.setBackground(Color.lightGray);
                                    peerInfoStatus1.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
                                    peerInfoStatus1.setBorder(null);

                                    //======== internalFrame1 ========
                                    {
                                        internalFrame1.setVisible(true);
                                        Container internalFrame1ContentPane = internalFrame1.getContentPane();

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

                                            //---- label8 ----
                                            architectureLabel.setText("Architecture Information");
                                            scrollPane1.setViewportView(architectureLabel);
                                        }

                                        GroupLayout internalFrame1ContentPaneLayout = new GroupLayout(
                                                internalFrame1ContentPane);
                                        internalFrame1ContentPane.setLayout(internalFrame1ContentPaneLayout);
                                        internalFrame1ContentPaneLayout.setHorizontalGroup(
                                                internalFrame1ContentPaneLayout.createParallelGroup()
                                                        .addGroup(internalFrame1ContentPaneLayout
                                                                .createSequentialGroup().addContainerGap()
                                                                .addComponent(scrollPane1,
                                                                        GroupLayout.DEFAULT_SIZE, 0,
                                                                        Short.MAX_VALUE)
                                                                .addContainerGap()));
                                        internalFrame1ContentPaneLayout.setVerticalGroup(
                                                internalFrame1ContentPaneLayout.createParallelGroup()
                                                        .addGroup(internalFrame1ContentPaneLayout
                                                                .createSequentialGroup().addContainerGap()
                                                                .addComponent(scrollPane1,
                                                                        GroupLayout.DEFAULT_SIZE, 0,
                                                                        Short.MAX_VALUE)
                                                                .addContainerGap()));
                                    }
                                    peerInfoStatus1.add(internalFrame1, JLayeredPane.DEFAULT_LAYER);
                                    internalFrame1.setBounds(15, 0, 365, 160);
                                }

                                //---- graphicONcheckBox ----
                                graphicONcheckBox.setText("Graphic ON");

                                //---- advancedConfirmBut ----
                                advancedConfirmBut.setIcon(new ImageIcon("resources/image/ok.png"));

                                GroupLayout peerInfoStatusLayout = new GroupLayout(peerInfoStatus);
                                peerInfoStatus.setLayout(peerInfoStatusLayout);
                                peerInfoStatusLayout.setHorizontalGroup(peerInfoStatusLayout
                                        .createParallelGroup()
                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                .addGroup(peerInfoStatusLayout.createParallelGroup()
                                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                                .addGap(26, 26, 26)
                                                                .addComponent(graphicONcheckBox)
                                                                .addGap(73, 73, 73)
                                                                .addComponent(jComboBoxNumRegionXPeer,
                                                                        GroupLayout.PREFERRED_SIZE,
                                                                        GroupLayout.DEFAULT_SIZE,
                                                                        GroupLayout.PREFERRED_SIZE)
                                                                .addGap(80, 80, 80)
                                                                .addComponent(advancedConfirmBut,
                                                                        GroupLayout.PREFERRED_SIZE, 33,
                                                                        GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                                .addContainerGap().addComponent(peerInfoStatus1,
                                                                        GroupLayout.DEFAULT_SIZE, 387,
                                                                        Short.MAX_VALUE)))
                                                .addContainerGap()));
                                peerInfoStatusLayout.setVerticalGroup(peerInfoStatusLayout.createParallelGroup()
                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                .addComponent(peerInfoStatus1, GroupLayout.PREFERRED_SIZE, 175,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(peerInfoStatusLayout
                                                        .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                                        .addGroup(GroupLayout.Alignment.LEADING,
                                                                peerInfoStatusLayout
                                                                        .createParallelGroup(
                                                                                GroupLayout.Alignment.BASELINE)
                                                                        .addComponent(graphicONcheckBox)
                                                                        .addComponent(jComboBoxNumRegionXPeer,
                                                                                GroupLayout.PREFERRED_SIZE,
                                                                                GroupLayout.DEFAULT_SIZE,
                                                                                GroupLayout.PREFERRED_SIZE))
                                                        .addComponent(advancedConfirmBut,
                                                                GroupLayout.Alignment.LEADING,
                                                                GroupLayout.PREFERRED_SIZE, 28,
                                                                GroupLayout.PREFERRED_SIZE))
                                                .addContainerGap(16, Short.MAX_VALUE)));
                            }

                            GroupLayout jPanelAdvancedMainLayout = new GroupLayout(jPanelAdvancedMain);
                            jPanelAdvancedMain.setLayout(jPanelAdvancedMainLayout);
                            jPanelAdvancedMainLayout.setHorizontalGroup(jPanelAdvancedMainLayout
                                    .createParallelGroup()
                                    .addGroup(jPanelAdvancedMainLayout.createSequentialGroup().addContainerGap()
                                            .addComponent(scrollPaneTree, GroupLayout.PREFERRED_SIZE, 207,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(peerInfoStatus, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addContainerGap()));
                            jPanelAdvancedMainLayout.setVerticalGroup(jPanelAdvancedMainLayout
                                    .createParallelGroup()
                                    .addGroup(GroupLayout.Alignment.TRAILING, jPanelAdvancedMainLayout
                                            .createSequentialGroup().addContainerGap()
                                            .addGroup(jPanelAdvancedMainLayout
                                                    .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                                    .addComponent(peerInfoStatus, GroupLayout.Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(scrollPaneTree, GroupLayout.Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE))
                                            .addContainerGap()));
                        }

                        //======== jPanelSetButton2 ========
                        {

                            //---- buttonSetConfigDefault2 ----
                            buttonSetConfigDefault2.setText("Set");

                            GroupLayout jPanelSetButton2Layout = new GroupLayout(jPanelSetButton2);
                            jPanelSetButton2.setLayout(jPanelSetButton2Layout);
                            jPanelSetButton2Layout.setHorizontalGroup(jPanelSetButton2Layout
                                    .createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING,
                                            jPanelSetButton2Layout.createSequentialGroup()
                                                    .addContainerGap(522, Short.MAX_VALUE)
                                                    .addComponent(buttonSetConfigDefault2,
                                                            GroupLayout.PREFERRED_SIZE, 76,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addGap(72, 72, 72)));
                            jPanelSetButton2Layout.setVerticalGroup(jPanelSetButton2Layout.createParallelGroup()
                                    .addGroup(GroupLayout.Alignment.TRAILING,
                                            jPanelSetButton2Layout.createSequentialGroup()
                                                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(buttonSetConfigDefault2).addContainerGap()));
                        }

                        GroupLayout jPanelAdvancedLayout = new GroupLayout(jPanelAdvanced);
                        jPanelAdvancedLayout.setHorizontalGroup(jPanelAdvancedLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelAdvancedLayout.createSequentialGroup()
                                        .addGroup(jPanelAdvancedLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(jPanelAdvancedMain, GroupLayout.DEFAULT_SIZE, 689,
                                                        Short.MAX_VALUE)
                                                .addComponent(jPanelSetButton2, GroupLayout.PREFERRED_SIZE, 681,
                                                        GroupLayout.PREFERRED_SIZE))
                                        .addContainerGap()));
                        jPanelAdvancedLayout.setVerticalGroup(jPanelAdvancedLayout
                                .createParallelGroup(Alignment.TRAILING)
                                .addGroup(jPanelAdvancedLayout.createSequentialGroup().addContainerGap()
                                        .addComponent(jPanelAdvancedMain, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addGap(18).addComponent(jPanelSetButton2, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
                        jPanelAdvanced.setLayout(jPanelAdvancedLayout);
                    }
                    tabbedPane2.addTab("Advanced", jPanelAdvanced);

                }

                //======== panelConsole ========
                {

                    //======== scrollPane3 ========
                    {

                        //---- textField1 ----
                        notifyArea.setEditable(false);
                        DefaultCaret caret = (DefaultCaret) notifyArea.getCaret();
                        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
                        scrollPane3.setViewportView(notifyArea);
                    }

                    GroupLayout panelConsoleLayout = new GroupLayout(panelConsole);
                    panelConsole.setLayout(panelConsoleLayout);
                    panelConsoleLayout.setHorizontalGroup(panelConsoleLayout.createParallelGroup()
                            .addGroup(panelConsoleLayout.createParallelGroup()
                                    .addGroup(panelConsoleLayout.createSequentialGroup()
                                            .addGap(0, 0, Short.MAX_VALUE)
                                            .addComponent(scrollPane3, GroupLayout.PREFERRED_SIZE, 679,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(0, 0, Short.MAX_VALUE)))
                            .addGap(0, 679, Short.MAX_VALUE));
                    panelConsoleLayout.setVerticalGroup(panelConsoleLayout.createParallelGroup()
                            .addGroup(panelConsoleLayout.createParallelGroup()
                                    .addGroup(panelConsoleLayout.createSequentialGroup()
                                            .addGap(0, 0, Short.MAX_VALUE)
                                            .addComponent(scrollPane3, GroupLayout.PREFERRED_SIZE, 76,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(0, 0, Short.MAX_VALUE)))
                            .addGap(0, 76, Short.MAX_VALUE));
                }

                GroupLayout jPanelContainerTabbedPaneLayout = new GroupLayout(jPanelContainerTabbedPane);
                jPanelContainerTabbedPaneLayout.setHorizontalGroup(jPanelContainerTabbedPaneLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelContainerTabbedPaneLayout.createSequentialGroup().addContainerGap()
                                .addGroup(jPanelContainerTabbedPaneLayout.createParallelGroup(Alignment.LEADING)
                                        .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 686,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(panelConsole, GroupLayout.DEFAULT_SIZE, 708,
                                                Short.MAX_VALUE))
                                .addContainerGap()));
                jPanelContainerTabbedPaneLayout.setVerticalGroup(jPanelContainerTabbedPaneLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelContainerTabbedPaneLayout.createSequentialGroup().addGap(3)
                                .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 384,
                                        GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(ComponentPlacement.RELATED)
                                .addComponent(panelConsole, GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)));
                jPanelContainerTabbedPane.setLayout(jPanelContainerTabbedPaneLayout);
            }
            {
                jPanelDeploying = new JPanel();
                tabbedPane2.addTab("Simulation Jar", null, jPanelDeploying, null);
                GroupLayout jPanelDeployingLayout = new GroupLayout(jPanelDeploying);
                jPanelDeploying.setLayout(jPanelDeployingLayout);
                {
                    jButtonLoadJar = new JButton();
                    jButtonLoadJar.setText("Load Jar");
                    jButtonLoadJar.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent evt) {

                            if (simulationFile != null) {

                                File dest = new File(FTP_HOME + dirSeparator + SIMULATION_DIR + dirSeparator
                                        + simulationFile.getName());
                                try {
                                    FileUtils.copyFile(simulationFile, dest);

                                    Digester dg = new Digester(DigestAlgorithm.MD5);

                                    InputStream in = new FileInputStream(dest);

                                    Properties prop = new Properties();

                                    try {

                                        prop.setProperty("MD5", dg.getDigest(in));

                                        String fileName = FilenameUtils
                                                .removeExtension(simulationFile.getName());
                                        //save properties to project root folder
                                        prop.store(new FileOutputStream(FTP_HOME + dirSeparator + SIMULATION_DIR
                                                + dirSeparator + fileName + ".hash"), null);

                                    } catch (IOException ex) {
                                        ex.printStackTrace();
                                    }

                                    System.out.println("MD5: " + dg.getDigest(in));

                                    loadSimulation();
                                } catch (IOException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }
                            }
                        }
                    });

                }

                jPanelDeployingLayout.setVerticalGroup(jPanelDeployingLayout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(jPanelDeployingLayout.createParallelGroup().addGroup(
                                GroupLayout.Alignment.LEADING,
                                jPanelDeployingLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                        .addComponent(jButtonLoadJar, GroupLayout.Alignment.BASELINE,
                                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(getJTextFieldPathSimJar(), GroupLayout.Alignment.BASELINE,
                                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.PREFERRED_SIZE))
                                .addComponent(getJButtonChoseSimJar(), GroupLayout.Alignment.LEADING,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 286,
                                GroupLayout.PREFERRED_SIZE));
                jPanelDeployingLayout
                        .setHorizontalGroup(jPanelDeployingLayout.createSequentialGroup().addGap(22, 22, 22)
                                .addComponent(getJTextFieldPathSimJar(), GroupLayout.PREFERRED_SIZE, 202,
                                        GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(getJButtonChoseSimJar(), GroupLayout.PREFERRED_SIZE, 27,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGap(24)
                                .addComponent(jButtonLoadJar, GroupLayout.PREFERRED_SIZE, 146,
                                        GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 155, Short.MAX_VALUE));
            }

            jPanelRunBatchTests = new JPanel();
            tabbedPane2.addTab("Run batch tests", null, jPanelRunBatchTests, null);

            JLabel lblSelectConfigurationFile = new JLabel("Select configuration file:");

            textFieldConfigFilePath = new JTextField();
            textFieldConfigFilePath.setColumns(10);

            JButton buttonChooseConfigFile = new JButton();
            buttonChooseConfigFile.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent arg0) {

                    configFile = showFileChooser();
                    if (configFile != null)
                        textFieldConfigFilePath.setText(configFile.getAbsolutePath());
                }
            });
            buttonChooseConfigFile.setIcon(new ImageIcon("it/isislab/dmason/resources/image/openFolder.png"));

            JButton buttonLoadConfig = new JButton("Start");
            buttonLoadConfig.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {

                    try {
                        if (configFile.getName().contains(".xml")) {
                            ClassLoader.getSystemClassLoader();
                            //File xsd = new File(xsdFilename);
                            InputStream xsd = new FileInputStream("resources/batch/batchSchema.xsd");

                            if (xsd != null) {
                                if (validateXML(configFile, xsd)) {

                                    Batch batch = loadConfigFromXML(configFile);

                                    if (batch != null) {
                                        textAreaBatchInfo.append(configFile.getName() + " loaded.\n");
                                        if (batch.getNeededWorkers() > peers.size()
                                                || batch.getNeededWorkers() == 0)
                                            JOptionPane.showMessageDialog(DMasonMaster.this,
                                                    "There are not enough workers to start the simulation");
                                        else {
                                            textAreaBatchInfo
                                                    .append("Simulation: " + batch.getSimulationName() + "\n");
                                            textAreaBatchInfo.append(
                                                    "Needed Worker: " + batch.getNeededWorkers() + "\n");
                                            textAreaBatchInfo.append("Balance: " + batch.isBalanced() + "\n");

                                            Set<List<EntryParam<String, Object>>> testList = generateTestsFrom(
                                                    batch);

                                            textAreaBatchInfo
                                                    .append("--------------------------------------\n");
                                            textAreaBatchInfo
                                                    .append("Number of experiments: " + testList.size() + "\n");
                                            ConcurrentLinkedQueue<List<EntryParam<String, Object>>> testQueue = new ConcurrentLinkedQueue<List<EntryParam<String, Object>>>();

                                            for (List<EntryParam<String, Object>> test : testList)
                                                testQueue.offer(test);

                                            //System.out.println("Test queue: "+testQueue.size());

                                            try {

                                                List<List<EntryWorkerScore<Integer, String>>> workersPartition = Util
                                                        .chopped(scoreList, batch.getNeededWorkers());

                                                //System.out.println(workersPartition.toString());

                                                testCount.set(0);
                                                totalTests = testList.size();

                                                progressBarBatchTest.setValue(0);
                                                progressBarBatchTest.setString("0 %");
                                                progressBarBatchTest.setStringPainted(true);

                                                batchLogger = Logger
                                                        .getLogger(BatchExecutor.class.getCanonicalName());
                                                batchStartedTime = System.currentTimeMillis();

                                                textAreaBatchInfo.append("Batch started at: "
                                                        + Util.getCurrentDateTime(batchStartedTime) + "\n");
                                                textAreaBatchInfo
                                                        .append("--------------------------------------\n");
                                                batchLogger.debug("Started at: " + batchStartedTime);
                                                int i = 1;
                                                BatchExecutor batchExec;
                                                for (List<EntryWorkerScore<Integer, String>> workers : workersPartition) {
                                                    try {

                                                        batchExec = new BatchExecutor(batch.getSimulationName(),
                                                                batch.isBalanced(), testQueue, master,
                                                                connection, root.getChildCount(),
                                                                getFPTAddress(), workers, "Batch" + i, 1,
                                                                textAreaBatchInfo);

                                                        batchExec.getObservable()
                                                                .addObserver(DMasonMaster.this);
                                                        batchExec.start();

                                                        //Thread.sleep(2000);
                                                        //textAreaBatchInfo.append("Batch Executor "+i+" started\n");

                                                        i++;

                                                        //not paraller simulation, I use only one batch executor
                                                        if (!chckbxParallelBatch.isSelected())
                                                            break;
                                                    } catch (Exception e1) {
                                                        // TODO Auto-generated catch block
                                                        e1.printStackTrace();
                                                    }

                                                }

                                            } catch (Exception e3) {
                                                // TODO Auto-generated catch block
                                                e3.printStackTrace();
                                            }

                                        }

                                    } else
                                        JOptionPane.showMessageDialog(DMasonMaster.this,
                                                "Error when loading config file");
                                } else
                                    JOptionPane.showMessageDialog(DMasonMaster.this,
                                            "The configuration file is not a valid file");
                            } else
                                JOptionPane.showMessageDialog(DMasonMaster.this,
                                        xsdFilename + " not exists, can't validate configuration file.");
                        } else
                            JOptionPane.showMessageDialog(DMasonMaster.this,
                                    "The file " + configFile.getName() + "is not a configuration file.");
                    } catch (HeadlessException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }

                }

            });

            JPanel panel = new JPanel();
            panel.setBorder(
                    new TitledBorder(null, "Batch Status", TitledBorder.LEADING, TitledBorder.TOP, null, null));

            chckbxParallelBatch = new JCheckBox("Parallel Batch");

            GroupLayout gl_jPanelRunBatchTests = new GroupLayout(jPanelRunBatchTests);
            gl_jPanelRunBatchTests.setHorizontalGroup(gl_jPanelRunBatchTests
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup().addContainerGap()
                            .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup()
                                            .addComponent(lblSelectConfigurationFile,
                                                    GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addComponent(textFieldConfigFilePath, GroupLayout.PREFERRED_SIZE,
                                                    250, GroupLayout.PREFERRED_SIZE)
                                            .addGap(10).addComponent(buttonChooseConfigFile,
                                                    GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup()
                                            .addComponent(chckbxParallelBatch).addGap(18)
                                            .addComponent(buttonLoadConfig))
                                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 666,
                                            GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
            gl_jPanelRunBatchTests.setVerticalGroup(gl_jPanelRunBatchTests
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup().addContainerGap()
                            .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(buttonChooseConfigFile, GroupLayout.PREFERRED_SIZE, 25,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(textFieldConfigFilePath, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblSelectConfigurationFile))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(chckbxParallelBatch).addComponent(buttonLoadConfig))
                            .addPreferredGap(ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                            .addComponent(panel, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap()));

            progressBarBatchTest = new JProgressBar();

            JLabel lblProgress = new JLabel("Progress:");
            GroupLayout gl_panel = new GroupLayout(panel);
            gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel
                    .createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
                            .addComponent(scrollPane4, GroupLayout.DEFAULT_SIZE, 641, Short.MAX_VALUE)
                            .addGroup(gl_panel.createSequentialGroup().addComponent(lblProgress).addGap(18)
                                    .addComponent(progressBarBatchTest, GroupLayout.PREFERRED_SIZE, 169,
                                            GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
            gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                            .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(lblProgress)
                                    .addComponent(progressBarBatchTest, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(scrollPane4, GroupLayout.PREFERRED_SIZE, 202,
                                    GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
            panel.setLayout(gl_panel);
            jPanelRunBatchTests.setLayout(gl_jPanelRunBatchTests);
            GroupLayout jPanelSetDistributionLayout = new GroupLayout(jPanelSetDistribution);
            jPanelSetDistributionLayout
                    .setHorizontalGroup(
                            jPanelSetDistributionLayout.createParallelGroup(Alignment.LEADING)
                                    .addGroup(jPanelSetDistributionLayout.createSequentialGroup()
                                            .addComponent(jPanelSettings, GroupLayout.PREFERRED_SIZE, 254,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addComponent(jPanelContainerTabbedPane, GroupLayout.PREFERRED_SIZE,
                                                    707, GroupLayout.PREFERRED_SIZE)
                                            .addContainerGap(21, Short.MAX_VALUE)));
            jPanelSetDistributionLayout.setVerticalGroup(jPanelSetDistributionLayout
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(jPanelSetDistributionLayout.createSequentialGroup()
                            .addGroup(jPanelSetDistributionLayout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(jPanelSettings, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanelContainerTabbedPane, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addContainerGap()));
            jPanelSetDistribution.setLayout(jPanelSetDistributionLayout);
        }

        textAreaBatchInfo = new JTextArea();
        textAreaBatchInfo.setEditable(false);
        DefaultCaret caret = (DefaultCaret) textAreaBatchInfo.getCaret();
        caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
        scrollPane4.setViewportView(textAreaBatchInfo);

        //---- jLabelPlayButton ----
        jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));

        //---- jLabelPauseButton ----
        jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));

        //---- labelStopButton ----
        jLabelPlayButton.setIcon(new ImageIcon("image/NotPlaying.png"));

        jLabelPlayButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent arg0) {
            }

            @Override
            public void mousePressed(MouseEvent arg0) {
            }

            @Override
            public void mouseExited(MouseEvent arg0) {
            }

            @Override
            public void mouseEntered(MouseEvent arg0) {
            }

            @Override
            public void mouseClicked(MouseEvent arg0) {

                jLabelPlayButton.setIcon(new ImageIcon("resources/image/Playing.png"));
                jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));
                jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
                jLabelResetButton.setIcon(new ImageIcon("resources/image/NotReload.png"));
                try {

                    master.play();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

        //---- labelStopButton2 ----   
        jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
        jLabelStopButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                jLabelStopButton.setIcon(new ImageIcon("resources/image/Stopped.png"));
                jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png"));
                jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));

                try {

                    Address FTPAddress = getFPTAddress();

                    if (FTPAddress != null) {
                        UpdateData ud = new UpdateData("", FTPAddress);
                        master.stop(ud);
                    }

                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        });

        //---- labelPauseButton ----
        jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));
        jLabelPauseButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOn.png"));
                jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
                jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png"));
                try {
                    master.pause();
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        });

        //======== jPanelNumStep ========
        {

            GroupLayout jPanelNumStepLayout = new GroupLayout(jPanelNumStep);
            jPanelNumStepLayout.setHorizontalGroup(
                    jPanelNumStepLayout.createParallelGroup(Alignment.TRAILING).addGap(0, 25, Short.MAX_VALUE));
            jPanelNumStepLayout.setVerticalGroup(
                    jPanelNumStepLayout.createParallelGroup(Alignment.LEADING).addGap(0, 28, Short.MAX_VALUE));
            jPanelNumStep.setLayout(jPanelNumStepLayout);
            jPanelNumStep.setPreferredSize(new java.awt.Dimension(89, 23));
        }
        {
            jLabelResetButton = new JLabel();
            jLabelResetButton.setIcon(new ImageIcon("resources/image/NotReload.png"));
            jLabelResetButton.setPreferredSize(new java.awt.Dimension(20, 20));

            jLabelResetButton.setVisible(enableReset);
        }

        // for resetting simulation
        jLabelResetButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent arg0) {

                if (connected) {
                    jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
                    jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png"));
                    jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));
                    jLabelResetButton.setIcon(new ImageIcon("resources/image/Reload.png"));

                    //send message to workers for resetting simulation
                    try {
                        master.reset();

                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                    //clean up topic from AcitveMQ
                    connection.resetTopic();

                    setSystemSettingsEnabled(true);

                    notifyArea.append("Simulation resetted\n");

                }

            }

            @Override
            public void mouseEntered(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void mouseExited(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void mousePressed(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void mouseReleased(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }
        });
        writeStepLabel = new JLabel();
        writeStepLabel.setText("0");

        lblTotalSteps = new JLabel("Steps:");

        GroupLayout panelMainLayout = new GroupLayout(panelMain);
        panelMainLayout.setHorizontalGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(panelMainLayout.createSequentialGroup()
                        .addComponent(jPanelContainerSettings, GroupLayout.PREFERRED_SIZE, 0,
                                GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                .addComponent(jPanelSetDistribution, 0, 986, Short.MAX_VALUE)
                                .addGroup(panelMainLayout.createSequentialGroup().addGap(636)
                                        .addGroup(panelMainLayout.createParallelGroup(Alignment.TRAILING)
                                                .addComponent(jLabelStep, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                                .addGroup(panelMainLayout.createSequentialGroup()
                                                        .addComponent(lblTotalSteps)
                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                                        .addComponent(writeStepLabel)))
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addComponent(jPanelNumStep, GroupLayout.PREFERRED_SIZE, 25,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                                .addGroup(panelMainLayout.createSequentialGroup().addGap(24)
                                                        .addComponent(jLabelPlayButton,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                                        .addComponent(jLabelPauseButton,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                                        .addComponent(jLabelStopButton,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE))
                                                .addGroup(panelMainLayout.createSequentialGroup().addGap(116)
                                                        .addComponent(jLabelResetButton,
                                                                GroupLayout.PREFERRED_SIZE, 30,
                                                                GroupLayout.PREFERRED_SIZE)))))
                        .addGap(12))
                .addComponent(jPanelContainerConnection, 0, 1004, Short.MAX_VALUE));
        panelMainLayout.setVerticalGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(panelMainLayout.createSequentialGroup()
                        .addComponent(jPanelContainerConnection, GroupLayout.PREFERRED_SIZE, 71,
                                GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                .addComponent(jPanelSetDistribution, GroupLayout.PREFERRED_SIZE, 518,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGroup(panelMainLayout.createSequentialGroup().addGap(29).addComponent(
                                        jPanelContainerSettings, GroupLayout.PREFERRED_SIZE, 489,
                                        GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                .addComponent(jLabelStopButton, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelPlayButton, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelPauseButton, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelResetButton, GroupLayout.PREFERRED_SIZE, 24,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGroup(panelMainLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(writeStepLabel, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(lblTotalSteps))
                                .addGroup(panelMainLayout.createSequentialGroup()
                                        .addComponent(jLabelStep, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(ComponentPlacement.RELATED).addComponent(jPanelNumStep,
                                                GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(13, Short.MAX_VALUE)));
        panelMain.setLayout(panelMainLayout);
    }

    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPaneLayout.setHorizontalGroup(
            contentPaneLayout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    contentPaneLayout
                            .createSequentialGroup().addContainerGap().addComponent(panelMain,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addContainerGap()));
    contentPaneLayout.setVerticalGroup(
            contentPaneLayout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    contentPaneLayout.createSequentialGroup().addContainerGap().addComponent(panelMain,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    contentPane.setLayout(contentPaneLayout);
    pack();
    setLocationRelativeTo(null);

    refreshServerLabel.setVisible(false);

    jButtonChoseSimJar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            simulationFile = showFileChooser();
            if (simulationFile != null)
                jTextFieldPathSimJar.setText(simulationFile.getAbsolutePath());
        }
    });

}

From source file:net.sf.jabref.gui.openoffice.OpenOfficePanel.java

private void showSettingsPopup() {
    JPopupMenu menu = new JPopupMenu();
    final JCheckBoxMenuItem autoSync = new JCheckBoxMenuItem(
            Localization.lang("Automatically sync bibliography when inserting citations"),
            preferences.syncWhenCiting());
    final JRadioButtonMenuItem useActiveBase = new JRadioButtonMenuItem(
            Localization.lang("Look up BibTeX entries in the active tab only"));
    final JRadioButtonMenuItem useAllBases = new JRadioButtonMenuItem(
            Localization.lang("Look up BibTeX entries in all open databases"));
    final JMenuItem clearConnectionSettings = new JMenuItem(Localization.lang("Clear connection settings"));
    ButtonGroup bg = new ButtonGroup();
    bg.add(useActiveBase);//from w  w  w  . ja v a 2s  .co  m
    bg.add(useAllBases);
    if (preferences.useAllDatabases()) {
        useAllBases.setSelected(true);
    } else {
        useActiveBase.setSelected(true);
    }

    autoSync.addActionListener(e -> preferences.setSyncWhenCiting(autoSync.isSelected()));

    useAllBases.addActionListener(e -> preferences.setUseAllDatabases(useAllBases.isSelected()));

    useActiveBase.addActionListener(e -> preferences.setUseAllDatabases(!useActiveBase.isSelected()));

    clearConnectionSettings.addActionListener(e -> frame.output(preferences.clearConnectionSettings()));

    menu.add(autoSync);
    menu.addSeparator();
    menu.add(useActiveBase);
    menu.add(useAllBases);
    menu.addSeparator();
    menu.add(clearConnectionSettings);
    menu.show(settingsB, 0, settingsB.getHeight());
}

From source file:jp.massbank.spectrumsearch.SearchPage.java

/**
 * ?/*from   ww  w  . j  a va  2s.c om*/
 */
private void createWindow() {

    // ??
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    ttm.setInitialDelay(50);
    ttm.setDismissDelay(8000);

    // Search?
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
            new EmptyBorder(1, 1, 1, 1));
    mainPanel.setBorder(border);

    // *********************************************************************
    // User File Query
    // *********************************************************************
    DefaultTableModel fileDm = new DefaultTableModel();
    fileSorter = new TableSorter(fileDm, TABLE_QUERY_FILE);
    queryFileTable = new JTable(fileSorter) {
        @Override
        public boolean isCellEditable(int row, int column) {
            //            super.isCellEditable(row, column);
            // ??????
            return false;
        }
    };
    queryFileTable.addMouseListener(new TblMouseListener());
    fileSorter.setTableHeader(queryFileTable.getTableHeader());
    queryFileTable.setRowSelectionAllowed(true);
    queryFileTable.setColumnSelectionAllowed(false);
    queryFileTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    String[] col = { COL_LABEL_NO, COL_LABEL_NAME, COL_LABEL_ID };
    ((DefaultTableModel) fileSorter.getTableModel()).setColumnIdentifiers(col);
    (queryFileTable.getColumn(queryFileTable.getColumnName(0))).setPreferredWidth(44);
    (queryFileTable.getColumn(queryFileTable.getColumnName(1))).setPreferredWidth(LEFT_PANEL_WIDTH - 44);
    (queryFileTable.getColumn(queryFileTable.getColumnName(2))).setPreferredWidth(70);

    ListSelectionModel lm = queryFileTable.getSelectionModel();
    lm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lm.addListSelectionListener(new LmFileListener());
    queryFilePane = new JScrollPane(queryFileTable);
    queryFilePane.addMouseListener(new PaneMouseListener());
    queryFilePane.setPreferredSize(new Dimension(300, 300));

    // *********************************************************************
    // Result
    // *********************************************************************
    DefaultTableModel resultDm = new DefaultTableModel();
    resultSorter = new TableSorter(resultDm, TABLE_RESULT);
    resultTable = new JTable(resultSorter) {
        @Override
        public String getToolTipText(MouseEvent me) {
            //            super.getToolTipText(me);
            // ?????
            Point pt = me.getPoint();
            int row = rowAtPoint(pt);
            if (row < 0) {
                return null;
            } else {
                int nameCol = getColumnModel().getColumnIndex(COL_LABEL_NAME);
                return " " + getValueAt(row, nameCol) + " ";
            }
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            //            super.isCellEditable(row, column);
            // ??????
            return false;
        }
    };
    resultTable.addMouseListener(new TblMouseListener());
    resultSorter.setTableHeader(resultTable.getTableHeader());

    JPanel dbPanel = new JPanel();
    dbPanel.setLayout(new BorderLayout());
    resultPane = new JScrollPane(resultTable);
    resultPane.addMouseListener(new PaneMouseListener());

    resultTable.setRowSelectionAllowed(true);
    resultTable.setColumnSelectionAllowed(false);
    resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    String[] col2 = { COL_LABEL_NAME, COL_LABEL_SCORE, COL_LABEL_HIT, COL_LABEL_ID, COL_LABEL_ION,
            COL_LABEL_CONTRIBUTOR, COL_LABEL_NO };

    resultDm.setColumnIdentifiers(col2);
    (resultTable.getColumn(resultTable.getColumnName(0))).setPreferredWidth(LEFT_PANEL_WIDTH - 180);
    (resultTable.getColumn(resultTable.getColumnName(1))).setPreferredWidth(70);
    (resultTable.getColumn(resultTable.getColumnName(2))).setPreferredWidth(20);
    (resultTable.getColumn(resultTable.getColumnName(3))).setPreferredWidth(70);
    (resultTable.getColumn(resultTable.getColumnName(4))).setPreferredWidth(20);
    (resultTable.getColumn(resultTable.getColumnName(5))).setPreferredWidth(70);
    (resultTable.getColumn(resultTable.getColumnName(6))).setPreferredWidth(50);

    ListSelectionModel lm2 = resultTable.getSelectionModel();
    lm2.addListSelectionListener(new LmResultListener());

    resultPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, 200));
    dbPanel.add(resultPane, BorderLayout.CENTER);

    // *********************************************************************
    // DB Query
    // *********************************************************************
    DefaultTableModel dbDm = new DefaultTableModel();
    querySorter = new TableSorter(dbDm, TABLE_QUERY_DB);
    queryDbTable = new JTable(querySorter) {
        @Override
        public boolean isCellEditable(int row, int column) {
            //            super.isCellEditable(row, column);
            // ??????
            return false;
        }
    };
    queryDbTable.addMouseListener(new TblMouseListener());
    querySorter.setTableHeader(queryDbTable.getTableHeader());
    queryDbPane = new JScrollPane(queryDbTable);
    queryDbPane.addMouseListener(new PaneMouseListener());

    int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
    queryDbPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, h));
    queryDbTable.setRowSelectionAllowed(true);
    queryDbTable.setColumnSelectionAllowed(false);
    queryDbTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    String[] col3 = { COL_LABEL_ID, COL_LABEL_NAME, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO };
    DefaultTableModel model = (DefaultTableModel) querySorter.getTableModel();
    model.setColumnIdentifiers(col3);

    // 
    queryDbTable.getColumn(queryDbTable.getColumnName(0)).setPreferredWidth(70);
    queryDbTable.getColumn(queryDbTable.getColumnName(1)).setPreferredWidth(LEFT_PANEL_WIDTH - 70);
    queryDbTable.getColumn(queryDbTable.getColumnName(2)).setPreferredWidth(70);
    queryDbTable.getColumn(queryDbTable.getColumnName(3)).setPreferredWidth(50);

    ListSelectionModel lm3 = queryDbTable.getSelectionModel();
    lm3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lm3.addListSelectionListener(new LmQueryDbListener());

    // ?
    JPanel btnPanel = new JPanel();
    btnName.addActionListener(new BtnSearchNameListener());
    btnAll.addActionListener(new BtnAllListener());
    btnPanel.add(btnName);
    btnPanel.add(btnAll);

    parentPanel2 = new JPanel();
    parentPanel2.setLayout(new BoxLayout(parentPanel2, BoxLayout.PAGE_AXIS));
    parentPanel2.add(btnPanel);
    parentPanel2.add(queryDbPane);

    // ?
    JPanel dispModePanel = new JPanel();
    isDispSelected = dispSelected.isSelected();
    isDispRelated = dispRelated.isSelected();
    if (isDispSelected) {
        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    } else if (isDispRelated) {
        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }
    Object[] retRadio = new Object[] { dispSelected, dispRelated };
    for (int i = 0; i < retRadio.length; i++) {
        ((JRadioButton) retRadio[i]).addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                if (isDispSelected != dispSelected.isSelected() || isDispRelated != dispRelated.isSelected()) {

                    isDispSelected = dispSelected.isSelected();
                    isDispRelated = dispRelated.isSelected();

                    // ??
                    resultTable.clearSelection();
                    resultPlot.clear();
                    compPlot.setPeaks(null, 1);
                    resultPlot.setPeaks(null, 0);
                    setAllPlotAreaRange();
                    pkgView.initResultRecInfo();

                    if (isDispSelected) {
                        resultTable.getSelectionModel()
                                .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                    } else if (isDispRelated) {
                        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                    }
                }
            }
        });
    }
    ButtonGroup disGroup = new ButtonGroup();
    disGroup.add(dispSelected);
    disGroup.add(dispRelated);
    dispModePanel.add(lbl2);
    dispModePanel.add(dispSelected);
    dispModePanel.add(dispRelated);

    JPanel paramPanel = new JPanel();
    paramPanel.add(etcPropertyButton);
    etcPropertyButton.setMargin(new Insets(0, 10, 0, 10));
    etcPropertyButton.addActionListener(new ActionListener() {
        private ParameterSetWindow ps = null;

        public void actionPerformed(ActionEvent e) {
            // ??????????
            if (!isSubWindow) {
                ps = new ParameterSetWindow(getParentFrame());
            } else {
                ps.requestFocus();
            }
        }
    });

    JPanel optionPanel = new JPanel();
    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
    optionPanel.add(dispModePanel);
    optionPanel.add(paramPanel);

    // PackageView?????
    pkgView = new PackageViewPanel();
    pkgView.initAllRecInfo();

    queryTabPane.addTab("DB", parentPanel2);
    queryTabPane.setToolTipTextAt(TAB_ORDER_DB, "Query from DB.");
    queryTabPane.addTab("File", queryFilePane);
    queryTabPane.setToolTipTextAt(TAB_ORDER_FILE, "Query from user file.");
    queryTabPane.setSelectedIndex(TAB_ORDER_DB);
    queryTabPane.setFocusable(false);
    queryTabPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {

            // ?
            queryPlot.clear();
            compPlot.clear();
            resultPlot.clear();
            queryPlot.setPeaks(null, 0);
            compPlot.setPeaks(null, 1);
            resultPlot.setPeaks(null, 0);

            // PackageView?
            pkgView.initAllRecInfo();

            // DB Hit?
            if (resultTabPane.getTabCount() > 0) {
                resultTabPane.setSelectedIndex(0);
            }
            DefaultTableModel dataModel = (DefaultTableModel) resultSorter.getTableModel();
            dataModel.setRowCount(0);
            hitLabel.setText(" ");

            // DB?User File??????
            queryTabPane.update(queryTabPane.getGraphics());
            if (queryTabPane.getSelectedIndex() == TAB_ORDER_DB) {
                parentPanel2.update(parentPanel2.getGraphics());
                updateSelectQueryTable(queryDbTable);
            } else if (queryTabPane.getSelectedIndex() == TAB_ORDER_FILE) {
                queryFilePane.update(queryFilePane.getGraphics());
                updateSelectQueryTable(queryFileTable);
            }
        }
    });

    //       
    JPanel queryPanel = new JPanel();
    queryPanel.setLayout(new BorderLayout());
    queryPanel.add(queryTabPane, BorderLayout.CENTER);
    queryPanel.add(optionPanel, BorderLayout.SOUTH);
    queryPanel.setMinimumSize(new Dimension(0, 170));

    JPanel jtp2Panel = new JPanel();
    jtp2Panel.setLayout(new BorderLayout());
    jtp2Panel.add(dbPanel, BorderLayout.CENTER);
    jtp2Panel.add(hitLabel, BorderLayout.SOUTH);
    jtp2Panel.setMinimumSize(new Dimension(0, 70));
    Color colorGreen = new Color(0, 128, 0);
    hitLabel.setForeground(colorGreen);

    resultTabPane.addTab("Result", jtp2Panel);
    resultTabPane.setToolTipTextAt(TAB_RESULT_DB, "Result of DB hit.");
    resultTabPane.setFocusable(false);

    queryPlot.setMinimumSize(new Dimension(0, 100));
    compPlot.setMinimumSize(new Dimension(0, 120));
    resultPlot.setMinimumSize(new Dimension(0, 100));
    int height = initAppletHight / 3;
    JSplitPane jsp_cmp2db = new JSplitPane(JSplitPane.VERTICAL_SPLIT, compPlot, resultPlot);
    JSplitPane jsp_qry2cmp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPlot, jsp_cmp2db);
    jsp_cmp2db.setDividerLocation(height);
    jsp_qry2cmp.setDividerLocation(height - 25);
    jsp_qry2cmp.setMinimumSize(new Dimension(190, 0));

    viewTabPane.addTab("Compare View", jsp_qry2cmp);
    viewTabPane.addTab("Package View", pkgView);
    viewTabPane.setToolTipTextAt(TAB_VIEW_COMPARE, "Comparison of query and result spectrum.");
    viewTabPane.setToolTipTextAt(TAB_VIEW_PACKAGE, "Package comparison of query and result spectrum.");
    viewTabPane.setSelectedIndex(TAB_VIEW_COMPARE);
    viewTabPane.setFocusable(false);

    JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPanel, resultTabPane);
    jsp.setDividerLocation(310);
    jsp.setMinimumSize(new Dimension(180, 0));
    jsp.setOneTouchExpandable(true);

    JSplitPane jsp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jsp, viewTabPane);
    int divideSize = (int) (initAppletWidth * 0.4);
    divideSize = (divideSize >= 180) ? divideSize : 180;
    jsp2.setDividerLocation(divideSize);
    jsp2.setOneTouchExpandable(true);

    mainPanel.add(jsp2, BorderLayout.CENTER);
    add(mainPanel);

    queryPlot.setSearchPage(this);
    compPlot.setSearchPage(this);
    resultPlot.setSearchPage(this);

    setJMenuBar(MenuBarGenerator.generateMenuBar(this));
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Initialisiere das Fenster Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * //from w w  w.j a  v a  2 s  .c om
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 */
private void initDialog() {
    setResizable(false);
    setIconImage(Toolkit.getDefaultToolkit().getImage(
            ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/search.png")));
    // setVisible( true );
    setBounds(100, 100, 750, 417);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.SOUTH);
    {
        btnCancel = new JButton(LangStrings.getString("ProgramProperetysDialog.btnCancel.text")); //$NON-NLS-1$
        btnCancel.setIcon(new ImageIcon(
                ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/114.png")));
        btnCancel.setHorizontalAlignment(SwingConstants.LEFT);
        btnCancel.setIconTextGap(15);
        btnCancel.setPreferredSize(new Dimension(180, 40));
        btnCancel.setMaximumSize(new Dimension(160, 40));
        btnCancel.setMargin(new Insets(6, 30, 6, 30));
        btnCancel.setForeground(Color.RED);
        btnCancel.setBackground(new Color(255, 192, 203));
        btnCancel.setActionCommand("cancel");
        btnCancel.addActionListener(this);
        btnCancel.addMouseMotionListener(this);
    }
    {
        btnOk = new JButton(LangStrings.getString("ProgramProperetysDialog.btnOk.text")); //$NON-NLS-1$
        btnOk.setIconTextGap(15);
        btnOk.setHorizontalAlignment(SwingConstants.LEFT);
        btnOk.setIcon(new ImageIcon(
                ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/31.png")));
        btnOk.setPreferredSize(new Dimension(180, 40));
        btnOk.setMaximumSize(new Dimension(160, 40));
        btnOk.setMargin(new Insets(6, 30, 6, 30));
        btnOk.setForeground(new Color(0, 100, 0));
        btnOk.setBackground(new Color(152, 251, 152));
        btnOk.setActionCommand("set_propertys");
        btnOk.addActionListener(this);
        btnOk.addMouseMotionListener(this);
    }
    unitsPanel = new JPanel();
    unitsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), " UNITS ", TitledBorder.LEADING,
            TitledBorder.TOP, null, null));
    pahtsPanel = new JPanel();
    pahtsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), " DIRECTORYS ",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
    gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING).addGroup(
            Alignment.LEADING,
            gl_contentPanel.createSequentialGroup().addContainerGap().addGroup(gl_contentPanel
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(pahtsPanel, GroupLayout.PREFERRED_SIZE, 714, GroupLayout.PREFERRED_SIZE)
                    .addGroup(gl_contentPanel.createSequentialGroup()
                            .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 160,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED, 394, Short.MAX_VALUE)
                            .addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE))
                    .addComponent(unitsPanel, GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_contentPanel.createSequentialGroup()
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pahtsPanel, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(unitsPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 28,
                                    GroupLayout.PREFERRED_SIZE))));
    databaseDirLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.databaseDirLabel.text")); //$NON-NLS-1$
    databaseDirTextField = new JTextField();
    databaseDirTextField.setEditable(false);
    databaseDirTextField.addMouseMotionListener(this);
    databaseDirTextField.setColumns(10);
    logfileLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.logFileLabel.text")); //$NON-NLS-1$
    logfileNameTextField = new JTextField();
    logfileNameTextField.setEditable(false);
    logfileNameTextField.addMouseMotionListener(this);
    logfileNameTextField.setColumns(10);
    moveDataCheckBox = new JCheckBox(LangStrings.getString("ProgramProperetysDialog.moveDataCheckBox.text")); //$NON-NLS-1$
    moveDataCheckBox.addMouseMotionListener(this);
    databaseDirFileButton = new JButton("");
    databaseDirFileButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    databaseDirFileButton.addActionListener(this);
    databaseDirFileButton.setActionCommand("choose_datadir");
    databaseDirFileButton.addMouseMotionListener(this);
    logfileNameButton = new JButton("");
    logfileNameButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    logfileNameButton.addActionListener(this);
    logfileNameButton.setActionCommand("choose_logfile");
    logfileNameButton.addMouseMotionListener(this);
    exportDirLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.exportDirLabel.text")); //$NON-NLS-1$
    exportDirTextField = new JTextField();
    exportDirTextField.setEditable(false);
    exportDirTextField.setColumns(10);
    exportDirButton = new JButton("");
    exportDirButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    exportDirButton.setActionCommand("choose_exportdir");
    exportDirButton.addActionListener(this);
    exportDirButton.addMouseMotionListener(this);
    GroupLayout gl_pahtsPanel = new GroupLayout(pahtsPanel);
    gl_pahtsPanel.setHorizontalGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING).addGroup(gl_pahtsPanel
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup().addGroup(gl_pahtsPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_pahtsPanel.createSequentialGroup()
                                    .addComponent(databaseDirLabel, GroupLayout.DEFAULT_SIZE, 419,
                                            Short.MAX_VALUE)
                                    .addGap(193))
                            .addGroup(gl_pahtsPanel.createSequentialGroup()
                                    .addComponent(databaseDirTextField, GroupLayout.DEFAULT_SIZE, 606,
                                            Short.MAX_VALUE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                            .addComponent(databaseDirFileButton, GroupLayout.PREFERRED_SIZE, 72,
                                    GroupLayout.PREFERRED_SIZE))
                    .addComponent(moveDataCheckBox, Alignment.TRAILING)
                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup()
                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_pahtsPanel.createSequentialGroup()
                                            .addComponent(logfileLabel, GroupLayout.DEFAULT_SIZE, 345,
                                                    Short.MAX_VALUE)
                                            .addGap(267))
                                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup()
                                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                                                    .addComponent(exportDirLabel, Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
                                                    .addComponent(logfileNameTextField,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
                                                    .addComponent(exportDirTextField, Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE))
                                            .addPreferredGap(ComponentPlacement.RELATED)))
                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                                    .addComponent(logfileNameButton, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(exportDirButton, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE))))
            .addContainerGap()));
    gl_pahtsPanel.setVerticalGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_pahtsPanel.createSequentialGroup()
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(databaseDirFileButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_pahtsPanel.createSequentialGroup().addComponent(databaseDirLabel)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(databaseDirTextField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                    .addGap(1).addComponent(moveDataCheckBox).addGap(18)
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(logfileNameButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_pahtsPanel.createSequentialGroup().addComponent(logfileLabel)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(logfileNameTextField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addGap(18).addComponent(exportDirLabel).addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(exportDirTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(exportDirButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(24)));
    pahtsPanel.setLayout(gl_pahtsPanel);
    defaultUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.defaultUnitsRadioButton.text")); //$NON-NLS-1$
    defaultUnitsRadioButton.setSelected(true);
    defaultUnitsRadioButton.setActionCommand("rbutton");
    defaultUnitsRadioButton.addActionListener(this);
    metricUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.metricUnitsRadioButton.text")); //$NON-NLS-1$
    metricUnitsRadioButton.setActionCommand("rbutton");
    metricUnitsRadioButton.addActionListener(this);
    imperialUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.imperialUnitsRadioButton.text")); //$NON-NLS-1$
    imperialUnitsRadioButton.addActionListener(this);
    imperialUnitsRadioButton.setActionCommand("rbutton");
    defaultUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.defaultUnitsLabel.text")); //$NON-NLS-1$
    metricUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.metricUnitsLabel.text")); //$NON-NLS-1$
    imperialUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.imperialUnitsLabel.text")); //$NON-NLS-1$
    GroupLayout gl_untitsPanel = new GroupLayout(unitsPanel);
    gl_untitsPanel.setHorizontalGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_untitsPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING, false)
                            .addComponent(metricUnitsRadioButton, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(imperialUnitsRadioButton, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(defaultUnitsRadioButton, GroupLayout.PREFERRED_SIZE, 132,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
                            .addComponent(metricUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                            .addComponent(defaultUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                            .addComponent(imperialUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_untitsPanel.setVerticalGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_untitsPanel.createSequentialGroup()
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(defaultUnitsRadioButton).addComponent(defaultUnitsLabel))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(metricUnitsRadioButton).addComponent(metricUnitsLabel))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(imperialUnitsRadioButton).addComponent(imperialUnitsLabel))
                    .addContainerGap(10, Short.MAX_VALUE)));
    unitsPanel.setLayout(gl_untitsPanel);
    contentPanel.setLayout(gl_contentPanel);
    unitsButtonGroup = new ButtonGroup();
    unitsButtonGroup.add(defaultUnitsRadioButton);
    unitsButtonGroup.add(metricUnitsRadioButton);
    unitsButtonGroup.add(imperialUnitsRadioButton);
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private JPanel buildTroubleshootingPanel() {
    final JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    ActionListener levelChange = new ActionListener() {
        @Override//from  w  w w  . j  a v  a  2  s .co m
        public void actionPerformed(ActionEvent e) {
            Level x = Level.parse(e.getActionCommand());
            if (Level.OFF.equals(x) || Level.INFO.equals(x) || Level.WARNING.equals(x)
                    || Level.SEVERE.equals(x))
                log.setLevel(x);
        }
    };
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new GridLayout(0, 1));
    logPanel.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
            CopiedFromOtherJars.getText("msg.logDetailPanel.border"))); //$NON-NLS-1$
    logPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    ButtonGroup logGroup = new ButtonGroup();
    for (Level type : new Level[] { Level.OFF, Level.INFO, Level.WARNING, Level.SEVERE }) {
        JRadioButton jrb = new JRadioButton(type.toString());
        jrb.setActionCommand(type.toString());
        jrb.addActionListener(levelChange);
        jrb.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), jrb.getBorder()));
        logPanel.add(jrb);
        logGroup.add(jrb);
        if (type == Level.WARNING) {
            jrb.setSelected(true);
            log.setLevel(type);
        }
    }
    jcbEnableAssertions.setAlignmentX(Component.LEFT_ALIGNMENT);
    jcbEnableAssertions.setText(CopiedFromOtherJars.getText("msg.info.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (!extraArgs.contains(ASSERTIONS_OPTION)) {
                    extraArgs = (ASSERTIONS_OPTION + " " + extraArgs); //$NON-NLS-1$
                }
            } else if (e.getStateChange() == ItemEvent.DESELECTED) {
                extraArgs = extraArgs.replace(ASSERTIONS_OPTION, ""); //$NON-NLS-1$
            }
            extraArgs = extraArgs.trim();
            jtfArgs.setText(extraArgs);
            updateCommand();
        }
    });
    p.add(logPanel, BorderLayout.NORTH);
    Box other = new Box(BoxLayout.PAGE_AXIS);
    other.add(jcbEnableAssertions);
    other.add(Box.createVerticalGlue());
    p.add(other, BorderLayout.CENTER);
    return p;
}