Example usage for javax.swing.border EmptyBorder EmptyBorder

List of usage examples for javax.swing.border EmptyBorder EmptyBorder

Introduction

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

Prototype

public EmptyBorder(int top, int left, int bottom, int right) 

Source Link

Document

Creates an empty border with the specified insets.

Usage

From source file:com.francetelecom.rd.dashboard.pc.DashboardPC.java

/**
 * Create the frame.//from w  w  w .  j  a v a 2s .  c  o m
 */
public DashboardPC() {

    myRulePanelMap = new HashMap<String, JPanel>();

    setResizable(false);
    setTitle("Home Life Context");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 583, 478);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    ruleTabContent = new JPanel();
    ruleTabContent.setBackground(SystemColor.control);
    ruleTabContent.setBorder(new EmptyBorder(5, 5, 5, 5));
    ruleTabContent.setLayout(null);

    nodeTabContent = new JPanel();
    nodeTabContent.setBackground(SystemColor.control);
    nodeTabContent.setBorder(new EmptyBorder(5, 5, 5, 5));
    nodeTabContent.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 11, 557, 422);
    tabbedPane.add("Rules", ruleTabContent);
    tabbedPane.setEnabledAt(0, true);

    rulesContent = new JPanel();
    int initialWidth = 2 * rulePanel_width + interCellSpace;
    int initialHeight = rulePanel_height;
    rulesContent.setBounds(10, 11, initialWidth, initialHeight);
    //ruleTabContent.add(rulesContent);
    rulesContent.setLayout(new GridLayout(0, 2, interCellSpace, interCellSpace));

    scrollRuleList = new JScrollPane(rulesContent);
    scrollRuleList.setBounds(1, 1, scrollArea_maxWidth, initialHeight);
    ruleTabContent.add(scrollRuleList);

    tabbedPane.add("Nodes", nodeTabContent);
    tabbedPane.setEnabledAt(1, true);
    contentPane.add(tabbedPane);

    /*
    // small rule panel
            
    JPanel panelRule = new JPanel();
    rulesContent.add(panelRule);
    panelRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelRule.setLayout(null);
            
    JPanel rulePanelServicePhoto = new JPanel();
    rulePanelServicePhoto.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    rulePanelServicePhoto.setBounds(10, 16, 27, 27);
    panelRule.add(rulePanelServicePhoto);
            
    JLabel ruleLblServiceName = new JLabel("Service friendly name");
    ruleLblServiceName.setFont(new Font("Arial", Font.BOLD, 15));
    ruleLblServiceName.setForeground(new Color(100, 149, 237));
    ruleLblServiceName.setBounds(47, 11, 212, 18);
    panelRule.add(ruleLblServiceName);
            
    JLabel ruleLblIf = new JLabel("IF");
    ruleLblIf.setForeground(Color.GRAY);
    ruleLblIf.setFont(new Font("Arial", Font.BOLD, 30));
    ruleLblIf.setBounds(10, 49, 27, 35);
    panelRule.add(ruleLblIf);
            
    JLabel ruleLblConditionParam = new JLabel("Condition parameter");
    ruleLblConditionParam.setFont(new Font("Arial", Font.BOLD, 13));
    ruleLblConditionParam.setForeground(Color.GRAY);
    ruleLblConditionParam.setBounds(47, 49, 192, 35);
    panelRule.add(ruleLblConditionParam);
            
    JLabel ruleLblOnDevice = new JLabel("on device name");
    ruleLblOnDevice.setForeground(Color.GRAY);
    ruleLblOnDevice.setFont(new Font("Arial", Font.PLAIN, 11));
    ruleLblOnDevice.setBounds(47, 29, 212, 14);
    panelRule.add(ruleLblOnDevice);
            
    // small add rule panel
            
    JPanel panelAddRule = new JPanel();
    rulesContent.add(panelAddRule);
    panelAddRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelAddRule.setLayout(null);
            
    JLabel addRuleLbl = new JLabel("Configure new rule");
    addRuleLbl.setHorizontalAlignment(SwingConstants.CENTER);
    addRuleLbl.setForeground(new Color(169, 169, 169));
    addRuleLbl.setFont(new Font("Arial", Font.BOLD, 13));
    addRuleLbl.setBounds(10, 25, 229, 27);
    panelAddRule.add(addRuleLbl);
            
    JButton addRuleBtn = new JButton("+");
    addRuleBtn.setForeground(new Color(128, 128, 128));
    addRuleBtn.setBounds(100, 57, 41, 23);
    panelAddRule.add(addRuleBtn);
     */
}

From source file:net.sf.taverna.t2.activities.wsdlsir.views.WSDLActivityConfigurationView.java

private void initComponents() {

    this.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);

    int gridy = 0;

    // title panel
    JPanel titlePanel = new JPanel(new BorderLayout());
    titlePanel.setBackground(Color.WHITE);
    JLabel titleLabel = new JLabel("Security configuration");
    titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
    titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
    DialogTextArea titleMessage = new DialogTextArea("Select a security profile for the service");
    titleMessage.setMargin(new Insets(5, 20, 10, 10));
    titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
    titleMessage.setEditable(false);//w ww  . j a  v a  2 s .  c  o m
    titleMessage.setFocusable(false);
    titlePanel.setBorder(new EmptyBorder(10, 10, 0, 10));
    titlePanel.add(titleLabel, BorderLayout.NORTH);
    titlePanel.add(titleMessage, BorderLayout.CENTER);
    addDivider(titlePanel, SwingConstants.BOTTOM, true);

    // Main panel
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new GridBagLayout());
    mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));

    //Create the radio buttons
    noSecurityRadioButton = new JRadioButton("None");
    noSecurityRadioButton.addItemListener(this);

    wsSecurityAuthNRadioButton = new JRadioButton("WS-Security username and password authentication");
    wsSecurityAuthNRadioButton.addItemListener(this);

    httpSecurityAuthNRadioButton = new JRadioButton("HTTP username and password authentication");
    httpSecurityAuthNRadioButton.addItemListener(this);

    SAMLSecurityAuthNRadioButton = new JRadioButton("SAML WEB SSO profile authentication");
    SAMLSecurityAuthNRadioButton.addItemListener(this);

    //Group the radio buttons
    buttonGroup = new ButtonGroup();
    buttonGroup.add(noSecurityRadioButton);
    buttonGroup.add(wsSecurityAuthNRadioButton);
    buttonGroup.add(httpSecurityAuthNRadioButton);
    buttonGroup.add(SAMLSecurityAuthNRadioButton);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;

    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 10, 0, 0);
    mainPanel.add(noSecurityRadioButton, gbc);

    noSecurityLabel = new JLabel("Service requires no security");
    noSecurityLabel.setFont(noSecurityLabel.getFont().deriveFont(11f));
    //      addDivider(noSecurityLabel, SwingConstants.BOTTOM, false);
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(0, 40, 10, 10);
    mainPanel.add(noSecurityLabel, gbc);

    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 10, 0, 0);
    mainPanel.add(httpSecurityAuthNRadioButton, gbc);

    ActionListener usernamePasswordListener = new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            // Get Credential Manager UI to get the username and password for the service
            CredentialManagerUI credManagerUI = CredentialManagerUI.getInstance();
            if (credManagerUI != null)
                credManagerUI.newPasswordForService(oldBean.getWsdl());
        }
    };

    httpSecurityAuthNLabel = new JLabel(
            "Service requires HTTP username and password in order to authenticate the user");
    httpSecurityAuthNLabel.setFont(httpSecurityAuthNLabel.getFont().deriveFont(11f));
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(0, 40, 10, 10);
    mainPanel.add(httpSecurityAuthNLabel, gbc);

    // Set username and password button;
    setHttpUsernamePasswordButton = new JButton("Set username and password");
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(0, 40, 10, 10);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0; // add any vertical space to this component
    mainPanel.add(setHttpUsernamePasswordButton, gbc);
    setHttpUsernamePasswordButton.addActionListener(usernamePasswordListener);

    /////SAML

    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 10, 0, 0);
    mainPanel.add(SAMLSecurityAuthNRadioButton, gbc);

    ActionListener getCookieListener = new ActionListener() {

        /**
         * This listener will use the CallPreparator to obtain the cookies (included shibsession_XXX cookie) and 
         * save it in the Credential Manager (as the password for user "nomatter")
         */
        public void actionPerformed(ActionEvent e) {
            try {
                WSDLParser parser = new WSDLParser(newBean.getWsdl());
                List<String> endpoints = parser.getOperationEndpointLocations(newBean.getOperation());
                for (String endpoint : endpoints) //Actually i am only expecting one endpoint
                {
                    if (debug)
                        System.out
                                .println("Obtaining a SAML cookies to save in credential manager:" + endpoint);

                    Cookie[] cookies = CallPreparator.createCookieForCallToEndpoint(endpoint);

                    // Uncomment for just the shibsession cookie
                    //                  Cookie[] cookiessession = new Cookie[1];
                    //                  for (Cookie cook : cookies)
                    //                     if (cook.getName().contains("shibsession"))
                    //                        cookiessession[0]=cook;
                    //                  cookies=cookiessession;

                    CredentialManager credman = CredentialManager.getInstance();
                    credman.saveUsernameAndPasswordForService(
                            new UsernamePassword("nomatter", serializetoString(cookies)), new URI(endpoint));
                }
            } catch (WSDLException ex) {
                System.err.println(
                        "Problem getting or saving SAML cookie: " + newBean.getWsdl() + ". " + ex.getMessage());
                ex.printStackTrace();
            } catch (ParserConfigurationException ex) {
                System.err.println(
                        "Problem getting or saving SAML cookie: " + newBean.getWsdl() + ". " + ex.getMessage());
                ex.printStackTrace();
            } catch (Exception ex) {
                System.err.println(
                        "Problem getting or saving SAML cookie: " + newBean.getWsdl() + ". " + ex.getMessage());
                ex.printStackTrace();
            }
        }
    };

    SAMLSecurityAuthNLabel = new JLabel("<html>"
            + "Service requires SAML Web SSO profile to be perfomed in order to authenticate the user. "
            + "A cookie will be saved in your Credential Manger. "
            + "In the case that it stops working, please delete the entry in your Credential Manager or re-authenticate"
            + "</html>");
    SAMLSecurityAuthNLabel.setFont(SAMLSecurityAuthNLabel.getFont().deriveFont(11f));
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(3, 40, 10, 10);
    mainPanel.add(SAMLSecurityAuthNLabel, gbc);

    // Set username and password button;
    setSAMLGETCookieButton = new JButton("Authenticate and save Authentication data in Credential Manger");
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(0, 40, 10, 10);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0; // add any vertical space to this component
    mainPanel.add(setSAMLGETCookieButton, gbc);
    setSAMLGETCookieButton.addActionListener(getCookieListener);

    //END SAML

    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 10, 0, 0);
    mainPanel.add(wsSecurityAuthNRadioButton, gbc);

    wsSecurityAuthNLabel = new JLabel(
            "Service requires WS-Security username and password in order to authenticate the user");
    wsSecurityAuthNLabel.setFont(wsSecurityAuthNLabel.getFont().deriveFont(11f));
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(0, 40, 0, 0);
    mainPanel.add(wsSecurityAuthNLabel, gbc);

    // Password type list
    passwordTypeComboBox = new JComboBox(passwordTypes);
    passwordTypeComboBox.setRenderer(new ComboBoxTooltipRenderer());
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(10, 40, 0, 0);
    mainPanel.add(passwordTypeComboBox, gbc);

    // 'Add timestamp' checkbox
    addTimestampCheckBox = new JCheckBox("Add a timestamp to SOAP message");
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 40, 10, 10);
    mainPanel.add(addTimestampCheckBox, gbc);

    // Set username and password button;
    setWsdlUsernamePasswordButton = new JButton("Set username and password");
    gbc.gridx = 0;
    gbc.gridy = gridy++;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(0, 40, 10, 10);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0; // add any vertical space to this component
    mainPanel.add(setWsdlUsernamePasswordButton, gbc);
    setWsdlUsernamePasswordButton.addActionListener(usernamePasswordListener);

    addDivider(mainPanel, SwingConstants.BOTTOM, true);

    // OK/Cancel button panel
    JPanel okCancelPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okPressed();
        }
    });
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancelPressed();
        }
    });
    okCancelPanel.add(cancelButton);
    okCancelPanel.add(okButton);

    // Enable/disable controls based on what is the current security profiles
    String securityProfile = oldBean.getSecurityProfile();
    if (securityProfile == null) {
        noSecurityRadioButton.setSelected(true);
    } else {
        if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD)
                || securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD)
                || securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)
                || securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) {
            wsSecurityAuthNRadioButton.setSelected(true);
        }
        if (securityProfile.equals(SecurityProfiles.HTTP_BASIC_AUTHN)
                || securityProfile.equals(SecurityProfiles.HTTP_DIGEST_AUTHN)) {
            httpSecurityAuthNRadioButton.setSelected(true);
        }
        if (securityProfile.equals(SecurityProfiles.SAMLWEBSSOAUTH)) {
            SAMLSecurityAuthNRadioButton.setSelected(true);
        }
        if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD)
                || securityProfile
                        .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) {
            passwordTypeComboBox.setSelectedItem(PLAINTEXT_PASSWORD);
        } else if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD)
                || securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) {
            passwordTypeComboBox.setSelectedItem(DIGEST_PASSWORD);
        }
        if (securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)
                || securityProfile
                        .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) {
            addTimestampCheckBox.setSelected(true);
        } else {
            addTimestampCheckBox.setSelected(false);
        }
    }

    // Put everything together
    JPanel layoutPanel = new JPanel(new BorderLayout());
    layoutPanel.add(titlePanel, BorderLayout.NORTH);
    layoutPanel.add(mainPanel, BorderLayout.CENTER);
    layoutPanel.add(okCancelPanel, BorderLayout.SOUTH);
    layoutPanel.setPreferredSize(new Dimension(550, 490));

    this.getContentPane().add(layoutPanel);
    this.pack();
}

From source file:edu.harvard.mcz.imagecapture.VerbatimClassifyDialog.java

protected void init() {
    setTitle("Interpret verbatim data into fields.");
    setBounds(100, 100, 1203, 899);/*w ww  . j  a  v  a 2  s.c  o  m*/
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    {
        JPanel panelVerbatimValues = new JPanel();
        contentPanel.add(panelVerbatimValues);
        GridBagLayout gbl_panelVerbatimValues = new GridBagLayout();
        gbl_panelVerbatimValues.columnWidths = new int[] { 70, 0, 0, 0, 35, 0, 58, 0, 0, 0 };
        gbl_panelVerbatimValues.rowHeights = new int[] { 15, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                83, 0 };
        gbl_panelVerbatimValues.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
                1.0 };
        gbl_panelVerbatimValues.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
        panelVerbatimValues.setLayout(gbl_panelVerbatimValues);
        {
            lblCount = new JLabel("New label");
            GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
            gbc_lblNewLabel.gridwidth = 2;
            gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
            gbc_lblNewLabel.anchor = GridBagConstraints.SOUTHWEST;
            gbc_lblNewLabel.gridx = 0;
            gbc_lblNewLabel.gridy = 0;
            panelVerbatimValues.add(lblCount, gbc_lblNewLabel);
        }

        JButton buttonFillFromLast = new JButton("Fill From Last");
        GridBagConstraints gbc_buttonFillFromLast = new GridBagConstraints();
        gbc_buttonFillFromLast.anchor = GridBagConstraints.SOUTH;
        gbc_buttonFillFromLast.insets = new Insets(0, 0, 5, 5);
        gbc_buttonFillFromLast.gridx = 3;
        gbc_buttonFillFromLast.gridy = 0;
        panelVerbatimValues.add(buttonFillFromLast, gbc_buttonFillFromLast);
        {
            JLabel lblNewLabel_1 = new JLabel("Field values to apply to all records.");
            GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
            gbc_lblNewLabel_1.anchor = GridBagConstraints.SOUTHEAST;
            gbc_lblNewLabel_1.gridwidth = 4;
            gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
            gbc_lblNewLabel_1.gridx = 4;
            gbc_lblNewLabel_1.gridy = 0;
            panelVerbatimValues.add(lblNewLabel_1, gbc_lblNewLabel_1);
        }
        {
            JLabel lblNewLabel_2 = new JLabel("Verbatim Locality");
            GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
            gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
            gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
            gbc_lblNewLabel_2.gridx = 0;
            gbc_lblNewLabel_2.gridy = 1;
            panelVerbatimValues.add(lblNewLabel_2, gbc_lblNewLabel_2);
        }
        {
            textFieldVerbLocality = new JTextArea();
            textFieldVerbLocality.setEditable(false);
            textFieldVerbLocality.setRows(5);
            GridBagConstraints gbc_textField = new GridBagConstraints();
            gbc_textField.gridheight = 3;
            gbc_textField.insets = new Insets(0, 0, 5, 5);
            gbc_textField.fill = GridBagConstraints.BOTH;
            gbc_textField.gridx = 1;
            gbc_textField.gridy = 1;
            panelVerbatimValues.add(textFieldVerbLocality, gbc_textField);
            textFieldVerbLocality.setColumns(30);
        }

        JLabel lblNewLabel = new JLabel("HigherGeography");
        GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
        gbc_lblNewLabel.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel.gridx = 3;
        gbc_lblNewLabel.gridy = 1;
        panelVerbatimValues.add(lblNewLabel, gbc_lblNewLabel);

        GridBagConstraints gbc_textFieldHigherGeography = new GridBagConstraints();
        gbc_textFieldHigherGeography.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldHigherGeography.gridwidth = 5;
        gbc_textFieldHigherGeography.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldHigherGeography.gridx = 4;
        gbc_textFieldHigherGeography.gridy = 1;
        panelVerbatimValues.add(getComboBoxHighGeog(), gbc_textFieldHigherGeography);

        JButton btnCopyLocality = new JButton(">");
        btnCopyLocality.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (textFieldSpecificLocality.getText().isEmpty()) {
                    textFieldSpecificLocality.setText(textFieldVerbLocality.getText().replace("\n", "").trim());
                }
            }
        });
        GridBagConstraints gbc_btnCopyLocality = new GridBagConstraints();
        gbc_btnCopyLocality.insets = new Insets(0, 0, 5, 5);
        gbc_btnCopyLocality.gridx = 2;
        gbc_btnCopyLocality.gridy = 2;
        panelVerbatimValues.add(btnCopyLocality, gbc_btnCopyLocality);

        JLabel lblSpecificLocality = new JLabel("Specific Locality");
        GridBagConstraints gbc_lblSpecificLocality = new GridBagConstraints();
        gbc_lblSpecificLocality.anchor = GridBagConstraints.EAST;
        gbc_lblSpecificLocality.insets = new Insets(0, 0, 5, 5);
        gbc_lblSpecificLocality.gridx = 3;
        gbc_lblSpecificLocality.gridy = 2;
        panelVerbatimValues.add(lblSpecificLocality, gbc_lblSpecificLocality);

        JLabel lblElevation = new JLabel("Elevation");
        GridBagConstraints gbc_lblElevation = new GridBagConstraints();
        gbc_lblElevation.anchor = GridBagConstraints.EAST;
        gbc_lblElevation.insets = new Insets(0, 0, 5, 5);
        gbc_lblElevation.gridx = 3;
        gbc_lblElevation.gridy = 3;
        panelVerbatimValues.add(lblElevation, gbc_lblElevation);

        textFieldMinElevation = new JTextField();
        textFieldMinElevation.setMinimumSize(new Dimension(60, 19));
        GridBagConstraints gbc_textFieldMinElevation = new GridBagConstraints();
        gbc_textFieldMinElevation.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldMinElevation.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldMinElevation.gridx = 4;
        gbc_textFieldMinElevation.gridy = 3;
        panelVerbatimValues.add(textFieldMinElevation, gbc_textFieldMinElevation);
        textFieldMinElevation.setColumns(4);

        JLabel lblTo = new JLabel("to");
        GridBagConstraints gbc_lblTo = new GridBagConstraints();
        gbc_lblTo.anchor = GridBagConstraints.EAST;
        gbc_lblTo.insets = new Insets(0, 0, 5, 5);
        gbc_lblTo.gridx = 5;
        gbc_lblTo.gridy = 3;
        panelVerbatimValues.add(lblTo, gbc_lblTo);

        textFieldMaxElevation = new JTextField();
        textFieldMaxElevation.setMinimumSize(new Dimension(60, 19));
        GridBagConstraints gbc_textFieldMaxElevation = new GridBagConstraints();
        gbc_textFieldMaxElevation.anchor = GridBagConstraints.WEST;
        gbc_textFieldMaxElevation.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldMaxElevation.gridx = 6;
        gbc_textFieldMaxElevation.gridy = 3;
        panelVerbatimValues.add(textFieldMaxElevation, gbc_textFieldMaxElevation);
        textFieldMaxElevation.setColumns(5);

        comboBoxElevUnits = new JComboBox();
        GridBagConstraints gbc_comboBoxElevUnits = new GridBagConstraints();
        gbc_comboBoxElevUnits.insets = new Insets(0, 0, 5, 5);
        gbc_comboBoxElevUnits.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBoxElevUnits.gridx = 7;
        gbc_comboBoxElevUnits.gridy = 3;
        panelVerbatimValues.add(comboBoxElevUnits, gbc_comboBoxElevUnits);
        {
            JLabel lblVerbatimdate = new JLabel("VerbatimDate");
            GridBagConstraints gbc_lblVerbatimdate = new GridBagConstraints();
            gbc_lblVerbatimdate.anchor = GridBagConstraints.EAST;
            gbc_lblVerbatimdate.insets = new Insets(0, 0, 5, 5);
            gbc_lblVerbatimdate.gridx = 0;
            gbc_lblVerbatimdate.gridy = 4;
            panelVerbatimValues.add(lblVerbatimdate, gbc_lblVerbatimdate);
        }

        textFieldVerbDate = new JTextField();
        GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints();
        gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbDate.gridx = 1;
        gbc_textFieldVerbDate.gridy = 4;
        panelVerbatimValues.add(textFieldVerbDate, gbc_textFieldVerbDate);
        textFieldVerbDate.setColumns(30);

        JButton btnCopyDate = new JButton(">");
        btnCopyDate.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (textFieldISODate.getText().isEmpty()) {
                    Map<String, String> extractResult = DateUtils
                            .extractDateFromVerbatim(textFieldVerbDate.getText().trim());
                    if (extractResult.containsKey("result")) {
                        textFieldISODate.setText(extractResult.get("result"));
                    }
                    if (extractResult.containsKey("resultState")) {
                        // TODO: Report suspect etc
                    }
                }
            }
        });
        GridBagConstraints gbc_btnCopyDate = new GridBagConstraints();
        gbc_btnCopyDate.insets = new Insets(0, 0, 5, 5);
        gbc_btnCopyDate.gridx = 2;
        gbc_btnCopyDate.gridy = 4;
        panelVerbatimValues.add(btnCopyDate, gbc_btnCopyDate);

        JLabel lblNewLabel_3 = new JLabel("ISO Date");
        GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints();
        gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_3.gridx = 3;
        gbc_lblNewLabel_3.gridy = 4;
        panelVerbatimValues.add(lblNewLabel_3, gbc_lblNewLabel_3);

        textFieldISODate = new JTextField();
        textFieldISODate.setInputVerifier(
                MetadataRetriever.getInputVerifier(Specimen.class, "ISODate", textFieldISODate));
        textFieldISODate.setToolTipText(MetadataRetriever.getFieldHelp(Specimen.class, "ISODate"));
        GridBagConstraints gbc_textFieldISODate = new GridBagConstraints();
        gbc_textFieldISODate.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldISODate.gridwidth = 5;
        gbc_textFieldISODate.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldISODate.gridx = 4;
        gbc_textFieldISODate.gridy = 4;
        panelVerbatimValues.add(textFieldISODate, gbc_textFieldISODate);
        textFieldISODate.setColumns(10);

        textFieldSpecificLocality = new JTextField();
        GridBagConstraints gbc_textFieldSpecificLocality = new GridBagConstraints();
        gbc_textFieldSpecificLocality.gridwidth = 5;
        gbc_textFieldSpecificLocality.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldSpecificLocality.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldSpecificLocality.gridx = 4;
        gbc_textFieldSpecificLocality.gridy = 2;
        panelVerbatimValues.add(textFieldSpecificLocality, gbc_textFieldSpecificLocality);
        textFieldSpecificLocality.setColumns(25);
        {
            JLabel lblVerbatimCollector = new JLabel("Verbatim Collector");
            GridBagConstraints gbc_lblVerbatimCollector = new GridBagConstraints();
            gbc_lblVerbatimCollector.anchor = GridBagConstraints.EAST;
            gbc_lblVerbatimCollector.insets = new Insets(0, 0, 5, 5);
            gbc_lblVerbatimCollector.gridx = 0;
            gbc_lblVerbatimCollector.gridy = 6;
            panelVerbatimValues.add(lblVerbatimCollector, gbc_lblVerbatimCollector);
        }

        textFieldVerbCollector = new JTextArea();
        textFieldVerbCollector.setEditable(false);
        textFieldVerbCollector.setRows(3);
        GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints();
        gbc_textFieldVerbCollector.gridheight = 2;
        gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollector.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbCollector.gridx = 1;
        gbc_textFieldVerbCollector.gridy = 6;
        panelVerbatimValues.add(textFieldVerbCollector, gbc_textFieldVerbCollector);
        textFieldVerbCollector.setColumns(30);

        JLabel lblCollectors = new JLabel("Collector(s)");
        GridBagConstraints gbc_lblCollectors = new GridBagConstraints();
        gbc_lblCollectors.anchor = GridBagConstraints.EAST;
        gbc_lblCollectors.insets = new Insets(0, 0, 5, 5);
        gbc_lblCollectors.gridx = 3;
        gbc_lblCollectors.gridy = 6;
        panelVerbatimValues.add(lblCollectors, gbc_lblCollectors);

        JButton btnAddCollector = new JButton("+");
        btnAddCollector.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                ((CollectorTableModel) jTableCollectors.getModel()).addCollector(new Collector(null, ""));
            }
        });
        GridBagConstraints gbc_btnAddCollector = new GridBagConstraints();
        gbc_btnAddCollector.anchor = GridBagConstraints.EAST;
        gbc_btnAddCollector.insets = new Insets(0, 0, 5, 5);
        gbc_btnAddCollector.gridx = 3;
        gbc_btnAddCollector.gridy = 7;
        panelVerbatimValues.add(btnAddCollector, gbc_btnAddCollector);

        GridBagConstraints gbc_collectorTable = new GridBagConstraints();
        gbc_collectorTable.insets = new Insets(0, 0, 5, 5);
        gbc_collectorTable.fill = GridBagConstraints.BOTH;
        gbc_collectorTable.gridx = 4;
        gbc_collectorTable.gridy = 6;
        gbc_collectorTable.gridheight = 2;
        gbc_collectorTable.gridwidth = 5;
        panelVerbatimValues.add(getJScrollPaneCollectors(), gbc_collectorTable);

        JLabel lblVerbatimCollection = new JLabel("Verbatim Collection");
        GridBagConstraints gbc_lblVerbatimCollection = new GridBagConstraints();
        gbc_lblVerbatimCollection.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimCollection.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimCollection.gridx = 0;
        gbc_lblVerbatimCollection.gridy = 8;
        panelVerbatimValues.add(lblVerbatimCollection, gbc_lblVerbatimCollection);

        textFieldVerbCollection = new JTextArea();
        textFieldVerbCollection.setEditable(false);
        textFieldVerbCollection.setRows(3);
        GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints();
        gbc_textFieldVerbCollection.gridheight = 2;
        gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollection.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbCollection.gridx = 1;
        gbc_textFieldVerbCollection.gridy = 8;
        panelVerbatimValues.add(textFieldVerbCollection, gbc_textFieldVerbCollection);
        textFieldVerbCollection.setColumns(30);

        JLabel lblCollection = new JLabel("Collection");
        GridBagConstraints gbc_lblCollection = new GridBagConstraints();
        gbc_lblCollection.anchor = GridBagConstraints.EAST;
        gbc_lblCollection.insets = new Insets(0, 0, 5, 5);
        gbc_lblCollection.gridx = 3;
        gbc_lblCollection.gridy = 8;
        panelVerbatimValues.add(lblCollection, gbc_lblCollection);

        GridBagConstraints gbc_textFieldCollection = new GridBagConstraints();
        gbc_textFieldCollection.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldCollection.gridwidth = 5;
        gbc_textFieldCollection.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldCollection.gridx = 4;
        gbc_textFieldCollection.gridy = 8;
        panelVerbatimValues.add(getJComboBoxCollection(), gbc_textFieldCollection);

        JLabel lblVerbatimNumbers = new JLabel("Verbatim Numbers");
        GridBagConstraints gbc_lblVerbatimNumbers = new GridBagConstraints();
        gbc_lblVerbatimNumbers.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimNumbers.gridx = 0;
        gbc_lblVerbatimNumbers.gridy = 10;
        panelVerbatimValues.add(lblVerbatimNumbers, gbc_lblVerbatimNumbers);

        textFieldVerbNumbers = new JTextArea();
        textFieldVerbNumbers.setRows(3);
        textFieldVerbNumbers.setEditable(false);
        GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints();
        gbc_textFieldVerbNumbers.gridheight = 2;
        gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbNumbers.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbNumbers.gridx = 1;
        gbc_textFieldVerbNumbers.gridy = 10;
        panelVerbatimValues.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers);
        textFieldVerbNumbers.setColumns(30);

        JLabel lblNumbers = new JLabel("Numbers");
        GridBagConstraints gbc_lblNumbers = new GridBagConstraints();
        gbc_lblNumbers.anchor = GridBagConstraints.EAST;
        gbc_lblNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_lblNumbers.gridx = 3;
        gbc_lblNumbers.gridy = 10;
        panelVerbatimValues.add(lblNumbers, gbc_lblNumbers);

        JButton btnAddNumber = new JButton("+");
        btnAddNumber.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                ((NumberTableModel) jTableNumbers.getModel())
                        .addNumber(new edu.harvard.mcz.imagecapture.data.Number(null, "", ""));
            }
        });
        GridBagConstraints gbc_btnAddNumber = new GridBagConstraints();
        gbc_btnAddNumber.anchor = GridBagConstraints.EAST;
        gbc_btnAddNumber.insets = new Insets(0, 0, 5, 5);
        gbc_btnAddNumber.gridx = 3;
        gbc_btnAddNumber.gridy = 11;
        panelVerbatimValues.add(btnAddNumber, gbc_btnAddNumber);

        GridBagConstraints gbc_numberTable = new GridBagConstraints();
        gbc_numberTable.insets = new Insets(0, 0, 5, 5);
        gbc_numberTable.fill = GridBagConstraints.BOTH;
        gbc_numberTable.gridx = 4;
        gbc_numberTable.gridy = 10;
        gbc_numberTable.gridheight = 2;
        gbc_numberTable.gridwidth = 5;
        panelVerbatimValues.add(this.getJScrollPaneNumbers(), gbc_numberTable);

        JLabel lblVerbatimOtherText = new JLabel("Verbatim Other Text");
        GridBagConstraints gbc_lblVerbatimOtherText = new GridBagConstraints();
        gbc_lblVerbatimOtherText.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimOtherText.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimOtherText.gridx = 0;
        gbc_lblVerbatimOtherText.gridy = 12;
        panelVerbatimValues.add(lblVerbatimOtherText, gbc_lblVerbatimOtherText);

        textFieldVerbUnclassifiedText = new JTextArea();
        textFieldVerbUnclassifiedText.setEditable(false);
        textFieldVerbUnclassifiedText.setRows(5);
        GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints();
        gbc_textFieldVerbUnclassifiedText.gridheight = 3;
        gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbUnclassifiedText.gridx = 1;
        gbc_textFieldVerbUnclassifiedText.gridy = 12;
        panelVerbatimValues.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText);
        textFieldVerbUnclassifiedText.setColumns(30);

        JLabel lblHabitat = new JLabel("Habitat");
        GridBagConstraints gbc_lblHabitat = new GridBagConstraints();
        gbc_lblHabitat.anchor = GridBagConstraints.EAST;
        gbc_lblHabitat.insets = new Insets(0, 0, 5, 5);
        gbc_lblHabitat.gridx = 3;
        gbc_lblHabitat.gridy = 12;
        panelVerbatimValues.add(lblHabitat, gbc_lblHabitat);

        textFieldHabitat = new JTextField();
        GridBagConstraints gbc_textFieldHabitat = new GridBagConstraints();
        gbc_textFieldHabitat.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldHabitat.gridwidth = 4;
        gbc_textFieldHabitat.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldHabitat.gridx = 4;
        gbc_textFieldHabitat.gridy = 12;
        panelVerbatimValues.add(textFieldHabitat, gbc_textFieldHabitat);
        textFieldHabitat.setColumns(10);

        JLabel lblMicrohabitat = new JLabel("Microhabitat");
        GridBagConstraints gbc_lblMicrohabitat = new GridBagConstraints();
        gbc_lblMicrohabitat.anchor = GridBagConstraints.EAST;
        gbc_lblMicrohabitat.insets = new Insets(0, 0, 5, 5);
        gbc_lblMicrohabitat.gridx = 3;
        gbc_lblMicrohabitat.gridy = 13;
        panelVerbatimValues.add(lblMicrohabitat, gbc_lblMicrohabitat);

        textFieldMicrohabitat = new JTextField();
        GridBagConstraints gbc_textFieldMicrohabitat = new GridBagConstraints();
        gbc_textFieldMicrohabitat.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldMicrohabitat.gridwidth = 4;
        gbc_textFieldMicrohabitat.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldMicrohabitat.gridx = 4;
        gbc_textFieldMicrohabitat.gridy = 13;
        panelVerbatimValues.add(textFieldMicrohabitat, gbc_textFieldMicrohabitat);
        textFieldMicrohabitat.setColumns(10);

        JLabel lblNewLabel_4 = new JLabel("Workflow Status");
        GridBagConstraints gbc_lblNewLabel_4 = new GridBagConstraints();
        gbc_lblNewLabel_4.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_4.gridx = 3;
        gbc_lblNewLabel_4.gridy = 15;
        panelVerbatimValues.add(lblNewLabel_4, gbc_lblNewLabel_4);

        comboBoxWorkflowStatus = new JComboBox(WorkFlowStatus.getVerbatimClassifiedWorkFlowStatusValues());
        comboBoxWorkflowStatus.setSelectedItem(WorkFlowStatus.STAGE_CLASSIFIED);
        GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints();
        gbc_comboBoxWorkflowStatus.gridwidth = 4;
        gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 5);
        gbc_comboBoxWorkflowStatus.gridx = 4;
        gbc_comboBoxWorkflowStatus.gridy = 15;
        panelVerbatimValues.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus);

        JButton btnApplyToAll = new JButton("Apply To All Records");
        GridBagConstraints gbc_btnApplyToAll = new GridBagConstraints();
        gbc_btnApplyToAll.gridwidth = 4;
        gbc_btnApplyToAll.insets = new Insets(0, 0, 5, 5);
        gbc_btnApplyToAll.gridx = 4;
        gbc_btnApplyToAll.gridy = 16;
        panelVerbatimValues.add(btnApplyToAll, gbc_btnApplyToAll);
        btnApplyToAll.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                saveChanges();
            }
        });
    }
    {
        JPanel panelRelatedData = new JPanel();
        contentPanel.add(panelRelatedData);
        GridBagLayout gbl_panelRelatedData = new GridBagLayout();
        gbl_panelRelatedData.maximumLayoutSize(panelRelatedData);
        gbl_panelRelatedData.columnWidths = new int[] { 20, 33, 1, 0 };
        gbl_panelRelatedData.rowHeights = new int[] { 25, 0 };
        gbl_panelRelatedData.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
        gbl_panelRelatedData.rowWeights = new double[] { 1.0, Double.MIN_VALUE };
        panelRelatedData.setLayout(gbl_panelRelatedData);
        {
            JLabel lblTaxa = new JLabel("Taxa");
            GridBagConstraints gbc_lblTaxa = new GridBagConstraints();
            gbc_lblTaxa.anchor = GridBagConstraints.NORTHEAST;
            gbc_lblTaxa.insets = new Insets(0, 0, 0, 5);
            gbc_lblTaxa.gridx = 0;
            gbc_lblTaxa.gridy = 0;
            panelRelatedData.add(lblTaxa, gbc_lblTaxa);
        }

        JScrollPane scrollPane = new JScrollPane();
        // scrollPane.setPreferredSize(new Dimension(1000,100));
        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
        gbc_scrollPane.anchor = GridBagConstraints.NORTH;
        gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
        gbc_scrollPane.fill = GridBagConstraints.BOTH;
        gbc_scrollPane.gridx = 1;
        gbc_scrollPane.gridy = 0;
        panelRelatedData.add(scrollPane, gbc_scrollPane);

        tableTaxa = new JTable();
        SpecimenLifeCycle sls = new SpecimenLifeCycle();
        tableTaxa.setModel(new CountValueTableModel(sls.findTaxaFromVerbatim(this.verbatimData),
                "Current Idenfifications for these verbatim values."));
        scrollPane.setViewportView(tableTaxa);
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton cancelButton = new JButton("Close");
            cancelButton.setActionCommand("Close");
            cancelButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }
            });
            buttonPane.add(cancelButton);
        }
    }
}

From source file:edu.snu.leader.discrete.simulator.SimulatorLauncherGUI.java

/**
 * Create the frame./*w  ww . ja  va2  s .c o m*/
 */
public SimulatorLauncherGUI() {
    NumberFormat countFormat = NumberFormat.getNumberInstance();
    countFormat.setParseIntegerOnly(true);

    NumberFormat doubleFormat = NumberFormat.getNumberInstance();
    doubleFormat.setMinimumIntegerDigits(1);
    doubleFormat.setMaximumFractionDigits(10);

    setTitle("Simulator");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 515, 340);
    setResizable(false);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    contentPane.add(tabbedPane, BorderLayout.CENTER);

    JPanel panelTab1 = new JPanel();
    tabbedPane.addTab("Simulator", null, panelTab1, null);

    JPanel panelAgentCount = new JPanel();
    panelTab1.add(panelAgentCount);

    JLabel lblNewLabel = new JLabel("Agent Count");
    panelAgentCount.add(lblNewLabel);

    sliderAgent = new JSlider();
    panelAgentCount.add(sliderAgent);
    sliderAgent.setValue(10);
    sliderAgent.setSnapToTicks(true);
    sliderAgent.setPaintTicks(true);
    sliderAgent.setPaintLabels(true);
    sliderAgent.setMinorTickSpacing(10);
    sliderAgent.setMajorTickSpacing(10);
    sliderAgent.setMinimum(10);
    sliderAgent.setMaximum(70);

    sliderAgent.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            Integer spinnerValue = (Integer) spinnerMaxEaten.getValue();
            if (spinnerValue > sliderAgent.getValue()) {
                spinnerValue = sliderAgent.getValue();
            }
            spinnerMaxEaten.setModel(new SpinnerNumberModel(spinnerValue, new Integer(0),
                    new Integer(sliderAgent.getValue()), new Integer(1)));
            JFormattedTextField tfMaxEaten = ((JSpinner.DefaultEditor) spinnerMaxEaten.getEditor())
                    .getTextField();
            tfMaxEaten.setEditable(false);
        }
    });

    JPanel panelCommType = new JPanel();
    panelTab1.add(panelCommType);

    JLabel lblNewLabel_1 = new JLabel("Communication Type");
    panelCommType.add(lblNewLabel_1);

    comboBoxCommType = new JComboBox<String>();
    panelCommType.add(comboBoxCommType);
    comboBoxCommType
            .setModel(new DefaultComboBoxModel<String>(new String[] { "Global", "Topological", "Metric" }));
    comboBoxCommType.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String item = (String) comboBoxCommType.getSelectedItem();
            if (item.equals("Topological")) {
                panelNearestNeighborCount.setVisible(true);
                panelMaxLocationRadius.setVisible(false);
            } else if (item.equals("Metric")) {
                panelNearestNeighborCount.setVisible(false);
                panelMaxLocationRadius.setVisible(true);
            } else if (item.equals("Global")) {
                panelNearestNeighborCount.setVisible(false);
                panelMaxLocationRadius.setVisible(false);
            }
        }
    });

    JPanel panelDestinationRadius = new JPanel();
    panelTab1.add(panelDestinationRadius);

    JLabel lblDestinationRadius = new JLabel("Destination Radius");
    panelDestinationRadius.add(lblDestinationRadius);

    frmtdtxtfldDestinationRadius = new JFormattedTextField(doubleFormat);
    frmtdtxtfldDestinationRadius.setColumns(4);
    frmtdtxtfldDestinationRadius.setValue((Number) 10);
    panelDestinationRadius.add(frmtdtxtfldDestinationRadius);

    JPanel panelResultsOutput = new JPanel();
    panelTab1.add(panelResultsOutput);

    JLabel lblResultsOutput = new JLabel("Results Output");
    panelResultsOutput.add(lblResultsOutput);

    final JCheckBox chckbxEskridge = new JCheckBox("Eskridge");
    panelResultsOutput.add(chckbxEskridge);

    final JCheckBox chckbxConflict = new JCheckBox("Conflict");
    panelResultsOutput.add(chckbxConflict);

    final JCheckBox chckbxPosition = new JCheckBox("Position");
    panelResultsOutput.add(chckbxPosition);

    final JCheckBox chckbxPredationResults = new JCheckBox("Predation");
    panelResultsOutput.add(chckbxPredationResults);

    JPanel panelMisc = new JPanel();
    panelTab1.add(panelMisc);

    JLabel lblNewLabel_3 = new JLabel("Misc");
    panelMisc.add(lblNewLabel_3);

    chckbxGraphical = new JCheckBox("Graphical?");
    chckbxGraphical.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (chckbxGraphical.isSelected()) {
                frmtdtxtfldRunCount.setValue((Number) 1);
                frmtdtxtfldRunCount.setEnabled(false);
                chckbxEskridge.setSelected(false);
                chckbxEskridge.setEnabled(false);
                String agentBuilder = (String) comboBoxAgentBuilder.getSelectedItem();
                if (agentBuilder.equals("Default")) {
                    comboBoxAgentBuilder.setSelectedIndex(1);
                }
            } else {
                chckbxEskridge.setEnabled(true);
                frmtdtxtfldRunCount.setEnabled(true);
            }
        }

    });
    panelMisc.add(chckbxGraphical);

    chckbxRandomSeed = new JCheckBox("Random Seed?");
    panelMisc.add(chckbxRandomSeed);

    chckbxPredationEnable = new JCheckBox("Predation?");
    chckbxPredationEnable.setSelected(true);
    chckbxPredationEnable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (chckbxPredationEnable.isSelected()) {
                panelPredationStuff.setVisible(true);
                panelPredationBoxes.setVisible(true);
                panelPredationConstant.setVisible(true);
                panelNonMoversSurvive.setVisible(true);
            } else {
                panelPredationStuff.setVisible(false);
                panelPredationBoxes.setVisible(false);
                panelPredationConstant.setVisible(false);
                panelNonMoversSurvive.setVisible(false);
            }
        }
    });
    panelMisc.add(chckbxPredationEnable);

    JPanel panelCounts = new JPanel();
    panelTab1.add(panelCounts);

    JLabel lblNewLabel_4 = new JLabel("Run Count");
    panelCounts.add(lblNewLabel_4);

    frmtdtxtfldRunCount = new JFormattedTextField(countFormat);
    frmtdtxtfldRunCount.setToolTipText("The number of runs. Each run has a different random seed.");
    panelCounts.add(frmtdtxtfldRunCount);
    frmtdtxtfldRunCount.setColumns(4);
    frmtdtxtfldRunCount.setValue((Number) 1);

    JLabel lblNewLabel_5 = new JLabel("Sim Count");
    panelCounts.add(lblNewLabel_5);

    frmtdtxtfldSimCount = new JFormattedTextField(countFormat);
    frmtdtxtfldSimCount
            .setToolTipText("The number of simulations per run. Each simulation uses the same random seed.");
    frmtdtxtfldSimCount.setColumns(4);
    frmtdtxtfldSimCount.setValue((Number) 1);
    panelCounts.add(frmtdtxtfldSimCount);

    JLabel lblNewLabel_6 = new JLabel("Max Time Steps");
    panelCounts.add(lblNewLabel_6);

    frmtdtxtfldMaxTimeSteps = new JFormattedTextField(countFormat);
    frmtdtxtfldMaxTimeSteps.setToolTipText("The max number of time steps per simulation.");
    frmtdtxtfldMaxTimeSteps.setColumns(6);
    frmtdtxtfldMaxTimeSteps.setValue((Number) 20000);
    panelCounts.add(frmtdtxtfldMaxTimeSteps);

    ////////Panel tab 2

    JPanel panelTab2 = new JPanel();
    tabbedPane.addTab("Parameters", null, panelTab2, null);

    JPanel panelDecisionCalculator = new JPanel();
    panelTab2.add(panelDecisionCalculator);

    JLabel lblDecisionCalculator = new JLabel("Decision Calculator");
    panelDecisionCalculator.add(lblDecisionCalculator);

    final JComboBox<String> comboBoxDecisionCalculator = new JComboBox<String>();
    panelDecisionCalculator.add(comboBoxDecisionCalculator);
    comboBoxDecisionCalculator.setModel(
            new DefaultComboBoxModel<String>(new String[] { "Default", "Conflict", "Conflict Uninformed" }));

    JPanel panelAgentBuilder = new JPanel();
    panelTab2.add(panelAgentBuilder);

    JLabel lblAgentBuilder = new JLabel("Agent Builder");
    panelAgentBuilder.add(lblAgentBuilder);

    comboBoxAgentBuilder = new JComboBox<String>();
    panelAgentBuilder.add(comboBoxAgentBuilder);
    comboBoxAgentBuilder.setModel(new DefaultComboBoxModel<String>(new String[] { "Default", "Simple Angular",
            "Personality Simple Angular", "Simple Angular Uninformed" }));
    comboBoxAgentBuilder.setSelectedIndex(1);
    comboBoxAgentBuilder.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (chckbxGraphical.isSelected()) {
                String agentBuilder = (String) comboBoxAgentBuilder.getSelectedItem();
                if (agentBuilder.equals("Default")) {
                    comboBoxAgentBuilder.setSelectedIndex(1);
                }
            }
        }
    });

    JPanel panelModel = new JPanel();
    panelTab2.add(panelModel);

    JLabel lblModel = new JLabel("Model");
    panelModel.add(lblModel);

    comboBoxModel = new JComboBox<String>();
    panelModel.add(comboBoxModel);
    comboBoxModel.setModel(new DefaultComboBoxModel<String>(new String[] { "Sueur", "Gautrais" }));
    comboBoxModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String item = (String) comboBoxModel.getSelectedItem();
            if (item.equals("Sueur")) {
                panelSueurValues.setVisible(true);
                panelGautraisValues.setVisible(false);
            } else if (item.equals("Gautrais")) {
                panelSueurValues.setVisible(false);
                panelGautraisValues.setVisible(true);
            }
        }
    });

    JPanel panelEnvironment = new JPanel();
    panelTab2.add(panelEnvironment);

    JLabel lblEnvironment = new JLabel("Environment");
    panelEnvironment.add(lblEnvironment);

    comboBoxEnvironment = new JComboBox<String>();
    comboBoxEnvironment.setModel(
            new DefaultComboBoxModel<String>(new String[] { "Minimum", "Medium", "Maximum", "Uninformed" }));
    comboBoxEnvironment.setSelectedIndex(1);
    comboBoxEnvironment.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String item = (String) comboBoxEnvironment.getSelectedItem();
            if (!item.equals("Uninformed")) {
                comboBoxDecisionCalculator.setEnabled(true);
                comboBoxAgentBuilder.setEnabled(true);
            }

            if (item.equals("Medium")) {
                panelAngle.setVisible(true);
                panelDistance.setVisible(true);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(false);
            } else if (item.equals("Minimum")) {
                panelAngle.setVisible(false);
                panelDistance.setVisible(false);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(false);
            } else if (item.equals("Maximum")) {
                panelAngle.setVisible(false);
                panelDistance.setVisible(false);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(false);
            } else if (item.equals("Uninformed")) {
                panelAngle.setVisible(true);
                panelDistance.setVisible(true);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(true);
                comboBoxDecisionCalculator.setSelectedIndex(2);
                comboBoxDecisionCalculator.setEnabled(false);
                comboBoxAgentBuilder.setSelectedIndex(3);
                comboBoxAgentBuilder.setEnabled(false);
            }
        }
    });
    panelEnvironment.add(comboBoxEnvironment);

    JPanel panelDefaultConflict = new JPanel();
    panelTab2.add(panelDefaultConflict);

    JLabel lblDefaultConflict = new JLabel("Default Conflict");
    panelDefaultConflict.add(lblDefaultConflict);

    final JSpinner spinnerDefaultConflict = new JSpinner();
    panelDefaultConflict.add(spinnerDefaultConflict);
    spinnerDefaultConflict.setModel(
            new SpinnerNumberModel(new Float(0.9f), new Float(0.1f), new Float(0.91f), new Float(0.05)));
    JFormattedTextField tfSpinnerConflict = ((JSpinner.DefaultEditor) spinnerDefaultConflict.getEditor())
            .getTextField();
    tfSpinnerConflict.setEditable(false);

    JPanel panelCancelationThreshold = new JPanel();
    panelTab2.add(panelCancelationThreshold);

    JLabel lblCancelationThreshold = new JLabel("Cancelation Threshold");
    panelCancelationThreshold.add(lblCancelationThreshold);

    final JSpinner spinnerCancelationThreshold = new JSpinner();
    panelCancelationThreshold.add(spinnerCancelationThreshold);
    spinnerCancelationThreshold.setModel(
            new SpinnerNumberModel(new Float(1.0f), new Float(0.0f), new Float(1.01f), new Float(0.05)));
    JFormattedTextField tfCancelationThreshold = ((JSpinner.DefaultEditor) spinnerCancelationThreshold
            .getEditor()).getTextField();
    tfCancelationThreshold.setEditable(false);

    JPanel panelStopAnywhere = new JPanel();
    panelTab2.add(panelStopAnywhere);

    final JCheckBox chckbxStopAnywhere = new JCheckBox("Stop Anywhere?");
    panelStopAnywhere.add(chckbxStopAnywhere);

    panelNearestNeighborCount = new JPanel();
    panelNearestNeighborCount.setVisible(false);
    panelTab2.add(panelNearestNeighborCount);

    JLabel lblNearestNeighborCount = new JLabel("Nearest Neighbor Count");
    panelNearestNeighborCount.add(lblNearestNeighborCount);

    frmtdtxtfldNearestNeighborCount = new JFormattedTextField(countFormat);
    panelNearestNeighborCount.add(frmtdtxtfldNearestNeighborCount);
    frmtdtxtfldNearestNeighborCount.setColumns(3);
    frmtdtxtfldNearestNeighborCount.setValue((Number) 10);

    panelMaxLocationRadius = new JPanel();
    panelMaxLocationRadius.setVisible(false);
    panelTab2.add(panelMaxLocationRadius);

    JLabel lblMaxLocationRadius = new JLabel("Max Location Radius");
    panelMaxLocationRadius.add(lblMaxLocationRadius);

    frmtdtxtfldMaxLocationRadius = new JFormattedTextField(doubleFormat);
    panelMaxLocationRadius.add(frmtdtxtfldMaxLocationRadius);
    frmtdtxtfldMaxLocationRadius.setColumns(5);
    frmtdtxtfldMaxLocationRadius.setValue((Number) 10.0);

    panelPredationBoxes = new JPanel();
    panelTab2.add(panelPredationBoxes);

    final JCheckBox chckbxUsePredationThreshold = new JCheckBox("Use Predation Threshold");
    panelPredationBoxes.add(chckbxUsePredationThreshold);

    final JCheckBox chckbxPopulationIndependent = new JCheckBox("Population Independent");
    chckbxPopulationIndependent.setSelected(true);
    panelPredationBoxes.add(chckbxPopulationIndependent);
    chckbxPopulationIndependent.setToolTipText(
            "Select this to allow predation to be independent of population size. Max predation for 10 agents will be the same as for 50 agents. ");

    panelPredationStuff = new JPanel();
    panelTab2.add(panelPredationStuff);

    JLabel lblPredationMinimum = new JLabel("Predation Minimum");
    panelPredationStuff.add(lblPredationMinimum);

    frmtdtxtfldPredationMinimum = new JFormattedTextField(doubleFormat);
    frmtdtxtfldPredationMinimum.setColumns(4);
    frmtdtxtfldPredationMinimum.setValue((Number) 0.0);
    panelPredationStuff.add(frmtdtxtfldPredationMinimum);

    JLabel lblPredationThreshold = new JLabel("Predation Threshold");
    panelPredationStuff.add(lblPredationThreshold);

    final JSpinner spinnerPredationThreshold = new JSpinner();
    panelPredationStuff.add(spinnerPredationThreshold);
    spinnerPredationThreshold.setModel(
            new SpinnerNumberModel(new Float(1.0f), new Float(0.0f), new Float(1.01f), new Float(0.05)));
    JFormattedTextField tfPredationThreshold = ((JSpinner.DefaultEditor) spinnerPredationThreshold.getEditor())
            .getTextField();
    tfPredationThreshold.setEditable(false);

    JLabel lblMaxEaten = new JLabel("Max Eaten");
    panelPredationStuff.add(lblMaxEaten);

    spinnerMaxEaten = new JSpinner();
    spinnerMaxEaten.setToolTipText("The max number eaten per time step.");
    panelPredationStuff.add(spinnerMaxEaten);
    spinnerMaxEaten.setModel(new SpinnerNumberModel(new Integer(10), new Integer(0),
            new Integer(sliderAgent.getValue()), new Integer(1)));
    JFormattedTextField tfMaxEaten = ((JSpinner.DefaultEditor) spinnerMaxEaten.getEditor()).getTextField();
    tfMaxEaten.setEditable(false);

    panelPredationConstant = new JPanel();
    panelTab2.add(panelPredationConstant);

    JLabel lblPredationConstant = new JLabel("Predation Constant");
    panelPredationConstant.add(lblPredationConstant);

    frmtdtxtfldPredationConstant = new JFormattedTextField(doubleFormat);
    panelPredationConstant.add(frmtdtxtfldPredationConstant);
    frmtdtxtfldPredationConstant.setToolTipText("Value should be positive. Recommended values are near 0.001");
    frmtdtxtfldPredationConstant.setColumns(4);
    frmtdtxtfldPredationConstant.setValue((Number) 0.001);

    panelNonMoversSurvive = new JPanel();
    panelTab2.add(panelNonMoversSurvive);

    final JCheckBox chckbxNonMoversSurvive = new JCheckBox("Non-movers Survive?");
    chckbxNonMoversSurvive.setSelected(false);
    panelNonMoversSurvive.add(chckbxNonMoversSurvive);

    ////////Tab 3

    JPanel panelTab3 = new JPanel();
    tabbedPane.addTab("Environment", null, panelTab3, null);
    panelTab3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    panelSueurValues = new JPanel();
    panelTab3.add(panelSueurValues);
    panelSueurValues.setLayout(new BoxLayout(panelSueurValues, BoxLayout.Y_AXIS));

    JLabel lblSueurValues = new JLabel("Sueur Values");
    lblSueurValues.setHorizontalAlignment(SwingConstants.TRAILING);
    lblSueurValues.setAlignmentX(Component.CENTER_ALIGNMENT);
    panelSueurValues.add(lblSueurValues);

    JPanel panelAlpha = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panelAlpha.getLayout();
    flowLayout.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelAlpha);

    JLabel lblAlpha = new JLabel("alpha");
    lblAlpha.setHorizontalAlignment(SwingConstants.CENTER);
    panelAlpha.add(lblAlpha);

    final JFormattedTextField frmtdtxtfldAlpha = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAlpha.setHorizontalAlignment(SwingConstants.TRAILING);
    lblAlpha.setLabelFor(frmtdtxtfldAlpha);
    panelAlpha.add(frmtdtxtfldAlpha);
    frmtdtxtfldAlpha.setColumns(6);
    frmtdtxtfldAlpha.setValue((Number) 0.006161429);

    JPanel panelAlphaC = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) panelAlphaC.getLayout();
    flowLayout_2.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelAlphaC);

    JLabel lblAlphaC = new JLabel("alpha c");
    panelAlphaC.add(lblAlphaC);

    final JFormattedTextField frmtdtxtfldAlphaC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAlphaC.setHorizontalAlignment(SwingConstants.TRAILING);
    lblAlphaC.setLabelFor(frmtdtxtfldAlphaC);
    panelAlphaC.add(frmtdtxtfldAlphaC);
    frmtdtxtfldAlphaC.setColumns(6);
    frmtdtxtfldAlphaC.setValue((Number) 0.009);

    JPanel panelBeta = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) panelBeta.getLayout();
    flowLayout_1.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelBeta);

    JLabel lblBeta = new JLabel("beta");
    panelBeta.add(lblBeta);

    final JFormattedTextField frmtdtxtfldBeta = new JFormattedTextField(doubleFormat);
    frmtdtxtfldBeta.setHorizontalAlignment(SwingConstants.TRAILING);
    panelBeta.add(frmtdtxtfldBeta);
    frmtdtxtfldBeta.setColumns(6);
    frmtdtxtfldBeta.setValue((Number) 0.013422819);

    JPanel panelBetaC = new JPanel();
    FlowLayout flowLayout_14 = (FlowLayout) panelBetaC.getLayout();
    flowLayout_14.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelBetaC);

    JLabel lblBetaC = new JLabel("beta c");
    panelBetaC.add(lblBetaC);

    final JFormattedTextField frmtdtxtfldBetaC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldBetaC.setHorizontalAlignment(SwingConstants.TRAILING);
    panelBetaC.add(frmtdtxtfldBetaC);
    frmtdtxtfldBetaC.setColumns(6);
    frmtdtxtfldBetaC.setValue((Number) (-0.009));

    JPanel panelS = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) panelS.getLayout();
    flowLayout_3.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelS);

    JLabel lblS = new JLabel("S");
    panelS.add(lblS);

    final JFormattedTextField frmtdtxtfldS = new JFormattedTextField(countFormat);
    frmtdtxtfldS.setHorizontalAlignment(SwingConstants.TRAILING);
    panelS.add(frmtdtxtfldS);
    frmtdtxtfldS.setColumns(6);
    frmtdtxtfldS.setValue((Number) 2);

    JPanel panelQ = new JPanel();
    FlowLayout flowLayout_4 = (FlowLayout) panelQ.getLayout();
    flowLayout_4.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelQ);

    JLabel lblQ = new JLabel("q");
    panelQ.add(lblQ);

    final JFormattedTextField frmtdtxtfldQ = new JFormattedTextField(doubleFormat);
    frmtdtxtfldQ.setHorizontalAlignment(SwingConstants.TRAILING);
    panelQ.add(frmtdtxtfldQ);
    frmtdtxtfldQ.setColumns(6);
    frmtdtxtfldQ.setValue((Number) 2.3);

    panelGautraisValues = new JPanel();
    panelGautraisValues.setVisible(false);
    panelTab3.add(panelGautraisValues);
    panelGautraisValues.setLayout(new BoxLayout(panelGautraisValues, BoxLayout.Y_AXIS));

    JLabel label = new JLabel("Gautrais Values");
    label.setAlignmentX(Component.CENTER_ALIGNMENT);
    panelGautraisValues.add(label);

    JPanel panelTauO = new JPanel();
    FlowLayout flowLayout_5 = (FlowLayout) panelTauO.getLayout();
    flowLayout_5.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelTauO);

    JLabel lblTauO = new JLabel("tau o");
    panelTauO.add(lblTauO);

    final JFormattedTextField frmtdtxtfldTaoO = new JFormattedTextField(doubleFormat);
    frmtdtxtfldTaoO.setHorizontalAlignment(SwingConstants.TRAILING);
    panelTauO.add(frmtdtxtfldTaoO);
    frmtdtxtfldTaoO.setColumns(4);
    frmtdtxtfldTaoO.setValue((Number) 1290);

    JPanel panelGammaC = new JPanel();
    FlowLayout flowLayout_6 = (FlowLayout) panelGammaC.getLayout();
    flowLayout_6.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelGammaC);

    JLabel lblGammaC = new JLabel("gamma c");
    panelGammaC.add(lblGammaC);

    final JFormattedTextField frmtdtxtfldGammaC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldGammaC.setHorizontalAlignment(SwingConstants.TRAILING);
    panelGammaC.add(frmtdtxtfldGammaC);
    frmtdtxtfldGammaC.setColumns(4);
    frmtdtxtfldGammaC.setValue((Number) 2.0);

    JPanel panelEpsilonC = new JPanel();
    FlowLayout flowLayout_7 = (FlowLayout) panelEpsilonC.getLayout();
    flowLayout_7.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelEpsilonC);

    JLabel lblEpsilonC = new JLabel("epsilon c");
    panelEpsilonC.add(lblEpsilonC);

    final JFormattedTextField frmtdtxtfldEpsilonC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldEpsilonC.setHorizontalAlignment(SwingConstants.TRAILING);
    panelEpsilonC.add(frmtdtxtfldEpsilonC);
    frmtdtxtfldEpsilonC.setColumns(4);
    frmtdtxtfldEpsilonC.setValue((Number) 2.3);

    JPanel panelAlphaF = new JPanel();
    FlowLayout flowLayout_8 = (FlowLayout) panelAlphaF.getLayout();
    flowLayout_8.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelAlphaF);

    JLabel lblAlphaF = new JLabel("alpha f");
    panelAlphaF.add(lblAlphaF);

    final JFormattedTextField frmtdtxtfldAlphaF = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAlphaF.setHorizontalAlignment(SwingConstants.TRAILING);
    panelAlphaF.add(frmtdtxtfldAlphaF);
    frmtdtxtfldAlphaF.setColumns(4);
    frmtdtxtfldAlphaF.setValue((Number) 162.3);

    JPanel panelBetaF = new JPanel();
    FlowLayout flowLayout_9 = (FlowLayout) panelBetaF.getLayout();
    flowLayout_9.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelBetaF);

    JLabel lblBetaF = new JLabel("beta f");
    panelBetaF.add(lblBetaF);

    final JFormattedTextField frmtdtxtfldBetaF = new JFormattedTextField(doubleFormat);
    frmtdtxtfldBetaF.setHorizontalAlignment(SwingConstants.TRAILING);
    panelBetaF.add(frmtdtxtfldBetaF);
    frmtdtxtfldBetaF.setColumns(4);
    frmtdtxtfldBetaF.setValue((Number) 75.4);

    JPanel panelEnvironmentVariables = new JPanel();
    panelTab3.add(panelEnvironmentVariables);
    panelEnvironmentVariables.setLayout(new BoxLayout(panelEnvironmentVariables, BoxLayout.Y_AXIS));

    JLabel lblEnvironmentVariables = new JLabel("Environment Variables");
    lblEnvironmentVariables.setAlignmentX(Component.CENTER_ALIGNMENT);
    panelEnvironmentVariables.add(lblEnvironmentVariables);

    panelAngle = new JPanel();
    FlowLayout flowLayout_10 = (FlowLayout) panelAngle.getLayout();
    flowLayout_10.setAlignment(FlowLayout.RIGHT);
    panelEnvironmentVariables.add(panelAngle);

    JLabel lblAngle = new JLabel("Angle");
    panelAngle.add(lblAngle);

    final JFormattedTextField frmtdtxtfldAngle = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAngle.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldAngle.setToolTipText("Angle between destinations");
    panelAngle.add(frmtdtxtfldAngle);
    frmtdtxtfldAngle.setColumns(3);
    frmtdtxtfldAngle.setValue((Number) 72.00);

    panelNumberOfDestinations = new JPanel();
    FlowLayout flowLayout_13 = (FlowLayout) panelNumberOfDestinations.getLayout();
    flowLayout_13.setAlignment(FlowLayout.RIGHT);
    panelNumberOfDestinations.setVisible(false);
    panelEnvironmentVariables.add(panelNumberOfDestinations);

    JLabel lblNumberOfDestinations = new JLabel("Number of Destinations");
    panelNumberOfDestinations.add(lblNumberOfDestinations);

    JFormattedTextField frmtdtxtfldNumberOfDestinations = new JFormattedTextField(countFormat);
    frmtdtxtfldNumberOfDestinations.setHorizontalAlignment(SwingConstants.TRAILING);
    panelNumberOfDestinations.add(frmtdtxtfldNumberOfDestinations);
    frmtdtxtfldNumberOfDestinations.setColumns(3);
    frmtdtxtfldNumberOfDestinations.setValue((Number) 2);

    panelDistance = new JPanel();
    FlowLayout flowLayout_11 = (FlowLayout) panelDistance.getLayout();
    flowLayout_11.setAlignment(FlowLayout.RIGHT);
    panelEnvironmentVariables.add(panelDistance);

    JLabel lblDistance = new JLabel("Distance");
    panelDistance.add(lblDistance);

    frmtdtxtfldDistance = new JFormattedTextField(doubleFormat);
    frmtdtxtfldDistance.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldDistance.setToolTipText("Distance the destination is from origin (0,0)");
    panelDistance.add(frmtdtxtfldDistance);
    frmtdtxtfldDistance.setColumns(3);
    frmtdtxtfldDistance.setValue((Number) 150.0);

    panelPercentage = new JPanel();
    FlowLayout flowLayout_12 = (FlowLayout) panelPercentage.getLayout();
    flowLayout_12.setAlignment(FlowLayout.RIGHT);
    panelEnvironmentVariables.add(panelPercentage);

    JLabel lblPercentage = new JLabel("Percentage");
    panelPercentage.add(lblPercentage);

    frmtdtxtfldPercentage = new JFormattedTextField(doubleFormat);
    frmtdtxtfldPercentage.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldPercentage.setToolTipText(
            "The percentage moving to one of the two destinations ( The other gets 1 - percentage).");
    panelPercentage.add(frmtdtxtfldPercentage);
    frmtdtxtfldPercentage.setColumns(3);
    frmtdtxtfldPercentage.setValue((Number) 0.500);

    panelInformedCount = new JPanel();
    panelEnvironmentVariables.add(panelInformedCount);

    JLabel lblInformedCount = new JLabel("Informed Count");
    panelInformedCount.add(lblInformedCount);

    final JFormattedTextField frmtdtxtfldInformedCount = new JFormattedTextField(countFormat);
    frmtdtxtfldInformedCount.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldInformedCount.setColumns(3);
    frmtdtxtfldInformedCount.setToolTipText(
            "The number of agents moving toward a preferred destination. This number is duplicated on the southern pole as well.");
    frmtdtxtfldInformedCount.setValue((Number) 4);
    panelInformedCount.setVisible(false);

    panelInformedCount.add(frmtdtxtfldInformedCount);

    JPanel panelStartButtons = new JPanel();

    JButton btnStartSimulation = new JButton("Create Simulator Instance");
    btnStartSimulation.setToolTipText("Creates a new simulator instance from the settings provided.");
    btnStartSimulation.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean isReady = true;
            ErrorPacketContainer errorPacketContainer = new ErrorPacketContainer();

            if (jframeErrorMessages != null && jframeErrorMessages.isVisible()) {
                jframeErrorMessages.dispose();
            }

            frmtdtxtfldRunCount.setBackground(Color.WHITE);
            frmtdtxtfldSimCount.setBackground(Color.WHITE);
            frmtdtxtfldMaxTimeSteps.setBackground(Color.WHITE);
            frmtdtxtfldPredationMinimum.setBackground(Color.WHITE);
            frmtdtxtfldPredationConstant.setBackground(Color.WHITE);
            frmtdtxtfldNearestNeighborCount.setBackground(Color.WHITE);
            frmtdtxtfldMaxLocationRadius.setBackground(Color.WHITE);
            frmtdtxtfldPercentage.setBackground(Color.WHITE);
            frmtdtxtfldDistance.setBackground(Color.WHITE);
            frmtdtxtfldDestinationRadius.setBackground(Color.WHITE);
            frmtdtxtfldAngle.setBackground(Color.WHITE);
            frmtdtxtfldInformedCount.setBackground(Color.WHITE);

            StringBuilder errorMessages = new StringBuilder();

            if (((Number) frmtdtxtfldRunCount.getValue()).intValue() <= 0) {
                errorMessages.append("Run Count must be positive\n");
                frmtdtxtfldRunCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Run Count must be positive", frmtdtxtfldRunCount, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldSimCount.getValue()).intValue() <= 0) {
                errorMessages.append("Sim Count must be positive\n");
                frmtdtxtfldSimCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Sim Count must be positive", frmtdtxtfldSimCount, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldMaxTimeSteps.getValue()).intValue() <= 0) {
                errorMessages.append("Max Time Steps must be positive\n");
                frmtdtxtfldMaxTimeSteps.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Max Time Steps must be positive", frmtdtxtfldMaxTimeSteps, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldPredationMinimum.getValue()).doubleValue() < 0
                    && chckbxPredationEnable.isSelected()) {
                errorMessages.append("Predation Minimum must be positive\n");
                frmtdtxtfldPredationMinimum.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Predation Minimum must be positive",
                        frmtdtxtfldPredationMinimum, 1);
                isReady = false;
            }
            if (((Number) frmtdtxtfldPredationConstant.getValue()).doubleValue() <= 0
                    && chckbxPredationEnable.isSelected()) {
                errorMessages.append("Predation Constant must be positive\n");
                frmtdtxtfldPredationConstant.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Predation Constant must be positive",
                        frmtdtxtfldPredationConstant, 1);
                isReady = false;
            }
            if (((Number) frmtdtxtfldNearestNeighborCount.getValue()).intValue() < 0
                    && panelNearestNeighborCount.isVisible()) {
                errorMessages.append("Nearest Neighbor Count must be positive\n");
                frmtdtxtfldNearestNeighborCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Nearest Neighbor Count must be positive",
                        frmtdtxtfldNearestNeighborCount, 1);
                isReady = false;
            }
            if (((Number) frmtdtxtfldMaxLocationRadius.getValue()).doubleValue() < 0
                    && panelMaxLocationRadius.isVisible()) {
                errorMessages.append("Max Location Radius must be positive\n");
                frmtdtxtfldMaxLocationRadius.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Max Location Radius must be positive",
                        frmtdtxtfldMaxLocationRadius, 1);
                isReady = false;
            }
            if ((((Number) frmtdtxtfldPercentage.getValue()).doubleValue() < 0.0
                    || ((Number) frmtdtxtfldPercentage.getValue()).doubleValue() > 1.0)
                    && panelPercentage.isVisible()) {
                errorMessages.append(
                        "Percentage needs to be greater than or equal to 0 and less than or equal to 1\n");
                frmtdtxtfldPercentage.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket(
                        "Percentage needs to be greater than or equal to 0 and less than or equal to 1",
                        frmtdtxtfldPercentage, 2);
                isReady = false;
            }
            if (((Number) frmtdtxtfldDistance.getValue()).doubleValue() <= 0
                    && frmtdtxtfldDistance.isVisible()) {
                errorMessages.append("Distance must be positive\n");
                frmtdtxtfldDistance.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Distance must be positive", frmtdtxtfldDistance, 2);
                isReady = false;
            }
            if (((Number) frmtdtxtfldDestinationRadius.getValue()).doubleValue() <= 0) {
                errorMessages.append("Destination Radius must be positive\n");
                frmtdtxtfldDestinationRadius.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Destination Radius must be positive",
                        frmtdtxtfldDestinationRadius, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldAngle.getValue()).doubleValue() < 0) {
                errorMessages.append("Angle must be positive or zero\n");
                frmtdtxtfldAngle.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Angle must be positive", frmtdtxtfldAngle, 2);
                isReady = false;
            }
            if (((Number) frmtdtxtfldInformedCount.getValue()).intValue() <= 0) {
                errorMessages.append("Informed Count must be positive\n");
                frmtdtxtfldInformedCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Informed Count must be positive", frmtdtxtfldInformedCount, 2);
                isReady = false;
            } else if (((Number) frmtdtxtfldInformedCount.getValue()).intValue() * 2 > sliderAgent.getValue()) {
                errorMessages.append("Informed Count should at most be half the count of total agents\n");
                frmtdtxtfldInformedCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket(
                        "Informed Count should at most be half the count of total agents",
                        frmtdtxtfldInformedCount, 2);
                isReady = false;
            }

            if (!isReady) {
                jframeErrorMessages = createJFrameErrorMessages(errorPacketContainer, tabbedPane);
                jframeErrorMessages.setVisible(true);
            } else {
                _simulatorProperties = new Properties();

                _simulatorProperties.put("run-count", String.valueOf(frmtdtxtfldRunCount.getValue()));
                _simulatorProperties.put("simulation-count", String.valueOf(frmtdtxtfldSimCount.getValue()));
                _simulatorProperties.put("max-simulation-time-steps",
                        String.valueOf(frmtdtxtfldMaxTimeSteps.getValue()));
                _simulatorProperties.put("random-seed", String.valueOf(1)); // Doesn't change
                _simulatorProperties.put("individual-count", String.valueOf(sliderAgent.getValue()));
                _simulatorProperties.put("run-graphical", String.valueOf(chckbxGraphical.isSelected()));
                _simulatorProperties.put("pre-calculate-probabilities", String.valueOf(false)); // Doesn't change
                _simulatorProperties.put("use-random-random-seed",
                        String.valueOf(chckbxRandomSeed.isSelected()));
                _simulatorProperties.put("can-multiple-initiate", String.valueOf(true)); // Doesn't change

                _simulatorProperties.put("eskridge-results", String.valueOf(chckbxEskridge.isSelected()));
                _simulatorProperties.put("conflict-results", String.valueOf(chckbxConflict.isSelected()));
                _simulatorProperties.put("position-results", String.valueOf(chckbxPosition.isSelected()));
                _simulatorProperties.put("predation-results",
                        String.valueOf(chckbxPredationResults.isSelected()));

                _simulatorProperties.put("communication-type",
                        String.valueOf(comboBoxCommType.getSelectedItem()).toLowerCase());

                _simulatorProperties.put("nearest-neighbor-count",
                        String.valueOf(frmtdtxtfldNearestNeighborCount.getValue()));
                _simulatorProperties.put("max-location-radius",
                        String.valueOf(frmtdtxtfldMaxLocationRadius.getValue()));

                _simulatorProperties.put("destination-size-radius",
                        String.valueOf(frmtdtxtfldDestinationRadius.getValue()));

                _simulatorProperties.put("max-agents-eaten-per-step",
                        String.valueOf(spinnerMaxEaten.getValue()));
                _simulatorProperties.put("enable-predator", String.valueOf(chckbxPredationEnable.isSelected()));
                _simulatorProperties.put("predation-probability-minimum",
                        String.valueOf(frmtdtxtfldPredationMinimum.getValue()));
                _simulatorProperties.put("predation-multiplier",
                        String.valueOf(frmtdtxtfldPredationConstant.getValue()));
                _simulatorProperties.put("use-predation-threshold",
                        String.valueOf(chckbxUsePredationThreshold.isSelected()));
                _simulatorProperties.put("predation-threshold",
                        String.valueOf(spinnerPredationThreshold.getValue()));
                _simulatorProperties.put("predation-by-population",
                        String.valueOf(chckbxPopulationIndependent.isSelected()));
                _simulatorProperties.put("count-non-movers-as-survivors",
                        String.valueOf(chckbxNonMoversSurvive.isSelected()));

                _simulatorProperties.put("stop-at-any-destination",
                        String.valueOf(chckbxStopAnywhere.isSelected()));

                _simulatorProperties.put("adhesion-time-limit",
                        String.valueOf(frmtdtxtfldMaxTimeSteps.getValue()));

                _simulatorProperties.put("alpha", String.valueOf(frmtdtxtfldAlpha.getValue()));
                _simulatorProperties.put("alpha-c", String.valueOf(frmtdtxtfldAlphaC.getValue()));
                _simulatorProperties.put("beta", String.valueOf(frmtdtxtfldBeta.getValue()));
                _simulatorProperties.put("beta-c", String.valueOf(frmtdtxtfldBetaC.getValue()));
                _simulatorProperties.put("S", String.valueOf(frmtdtxtfldS.getValue()));
                _simulatorProperties.put("q", String.valueOf(frmtdtxtfldQ.getValue()));

                _simulatorProperties.put("lambda", String.valueOf(0.2));

                _simulatorProperties.put("tau-o", String.valueOf(frmtdtxtfldTaoO.getValue()));
                _simulatorProperties.put("gamma-c", String.valueOf(frmtdtxtfldGammaC.getValue()));
                _simulatorProperties.put("epsilon-c", String.valueOf(frmtdtxtfldEpsilonC.getValue()));
                _simulatorProperties.put("alpha-f", String.valueOf(frmtdtxtfldAlphaF.getValue()));
                _simulatorProperties.put("beta-f", String.valueOf(frmtdtxtfldBetaF.getValue()));

                _simulatorProperties.put("default-conflict-value",
                        String.valueOf(spinnerDefaultConflict.getValue()));

                _simulatorProperties.put("cancellation-threshold",
                        String.valueOf(spinnerCancelationThreshold.getValue()));
                StringBuilder sbAgentBuilder = new StringBuilder();
                sbAgentBuilder.append("edu.snu.leader.discrete.simulator.Sueur");
                sbAgentBuilder.append(comboBoxAgentBuilder.getSelectedItem().toString().replace(" ", ""));
                sbAgentBuilder.append("AgentBuilder");
                _simulatorProperties.put("agent-builder", String.valueOf(sbAgentBuilder.toString()));

                StringBuilder sbDecisionCalculator = new StringBuilder();
                sbDecisionCalculator.append("edu.snu.leader.discrete.simulator.");
                sbDecisionCalculator.append(comboBoxModel.getSelectedItem());
                //                    sbDecisionCalculator.append(comboBoxDecisionCalculator.getSelectedItem());
                sbDecisionCalculator
                        .append(comboBoxDecisionCalculator.getSelectedItem().toString().replace(" ", ""));
                sbDecisionCalculator.append("DecisionCalculator");
                _simulatorProperties.put("decision-calculator",
                        String.valueOf(sbDecisionCalculator.toString()));

                StringBuilder sbLocationsFile = new StringBuilder();
                sbLocationsFile.append("cfg/sim/locations/metric/valid-metric-loc-");
                sbLocationsFile.append(String.format("%03d", sliderAgent.getValue()));
                sbLocationsFile.append("-seed-00001.dat");
                _simulatorProperties.put("locations-file", String.valueOf(sbLocationsFile.toString()));

                //create destination file
                DestinationBuilder db = new DestinationBuilder(sliderAgent.getValue(), 1L);

                StringBuilder sbDestinationsFile = new StringBuilder();
                sbDestinationsFile.append("cfg/sim/destinations/destinations-");
                switch (comboBoxEnvironment.getSelectedItem().toString()) {
                case ("Minimum"):
                    sbDestinationsFile.append("diffdis-" + sliderAgent.getValue());
                    sbDestinationsFile.append("-per-" + frmtdtxtfldPercentage.getValue());
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generateDifferentDistance(((Number) frmtdtxtfldPercentage.getValue()).doubleValue(), 200,
                            100, 75);
                    break;
                case ("Medium"):
                    sbDestinationsFile.append("split-" + sliderAgent.getValue());
                    sbDestinationsFile.append("-dis-" + frmtdtxtfldDistance.getValue());
                    sbDestinationsFile.append("-ang-"
                            + String.format("%.2f", ((Number) frmtdtxtfldAngle.getValue()).doubleValue()));
                    sbDestinationsFile.append("-per-"
                            + String.format("%.3f", ((Number) frmtdtxtfldPercentage.getValue()).doubleValue()));
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generateSplitNorth(((Number) frmtdtxtfldDistance.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldAngle.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldPercentage.getValue()).doubleValue());
                    break;
                case ("Maximum"):
                    sbDestinationsFile.append("poles-" + sliderAgent.getValue());
                    sbDestinationsFile.append("-per-" + frmtdtxtfldPercentage.getValue());
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generatePoles(50, 100, ((Number) frmtdtxtfldPercentage.getValue()).doubleValue());
                    break;
                case ("Uninformed"):
                    sbDestinationsFile.append("split-poles-" + frmtdtxtfldInformedCount.getValue());
                    sbDestinationsFile.append("-dis-"
                            + String.format("%.1f", ((Number) frmtdtxtfldDistance.getValue()).doubleValue()));
                    sbDestinationsFile.append("-ang-"
                            + String.format("%.2f", ((Number) frmtdtxtfldAngle.getValue()).doubleValue()));
                    sbDestinationsFile.append("-per-"
                            + String.format("%.3f", ((Number) frmtdtxtfldPercentage.getValue()).doubleValue()));
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generateSplitPoles(((Number) frmtdtxtfldDistance.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldAngle.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldPercentage.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldInformedCount.getValue()).intValue());
                    break;
                default: //Should never happen
                    break;
                }
                _simulatorProperties.put("destinations-file", String.valueOf(sbDestinationsFile.toString()));

                _simulatorProperties.put("live-delay", String.valueOf(15)); //Doesn't change
                _simulatorProperties.put("results-dir", "results"); //Doesn't change

                new Thread(new Runnable() {
                    public void run() {
                        try {
                            runSimulation();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
        }

    });
    panelStartButtons.add(btnStartSimulation);

    JButton btnStartSimulationFrom = new JButton("Run Simulation from Properties File");
    btnStartSimulationFrom
            .setToolTipText("Runs the simulator with the values provided in the properties file.");
    btnStartSimulationFrom.setEnabled(false);
    panelStartButtons.add(btnStartSimulationFrom);

    panelTab3.add(panelStartButtons);
}

From source file:com.itemanalysis.jmetrik.gui.Jmetrik.java

public Jmetrik() {
    super("jMetrik");
    setPreferredSize(new Dimension(1024, 650));
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    //properly close database if user closes window
    this.addWindowListener(new WindowAdapter() {
        @Override//  w  w  w  .  ja v  a2 s  .  c o m
        public void windowClosing(WindowEvent we) {
            if (workspace != null) {
                workspace.closeDatabase();
            }
            System.exit(0);
        }
    });

    //add statusbar
    statusBar = new StatusBar(1024, 30);
    statusBar.setBorder(new EmptyBorder(2, 2, 2, 2));
    getContentPane().add(statusBar, BorderLayout.SOUTH);

    //start logging
    startLog();

    //left-right splitpane
    JSplitPane splitPane1 = new JSplitPane();
    splitPane1.setDividerLocation(200);

    //setup workspace list
    workspaceList = new JList();
    workspaceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    workspaceList.setModel(new SortedListModel<DataTableName>());
    workspaceList.addKeyListener(new DeleteKeyListener());
    //        workspaceList.getInsets().set(5, 5, 5, 5);

    //add icon to list cell renderer
    String urlString = "/images/spreadsheet.png";
    URL url = this.getClass().getResource(urlString);
    final ImageIcon tableIcon = new ImageIcon(url, "Table");
    workspaceList.setCellRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            label.setIcon(tableIcon);
            return label;
        }
    });

    JScrollPane scrollPane1 = new JScrollPane(workspaceList);
    scrollPane1.setPreferredSize(new Dimension(200, 698));

    splitPane1.setLeftComponent(scrollPane1);

    //tabbed pane for top pane
    tabbedPane = new JTabbedPane();
    tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);

    //setup data table
    dataTable = new DataTable();
    dataTable.setRowHeight(18);

    //change size of table header and center text
    JTableHeader header = dataTable.getTableHeader();
    header.setDefaultRenderer(new TableHeaderCellRenderer());

    JScrollPane dataScrollPane = new JScrollPane(dataTable);
    tabbedPane.addTab("Data", dataScrollPane);

    //setup variable table
    variableTable = new DataTable();
    variableTable.setRowHeight(18);
    variableTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            if (e.getClickCount() == 2) {
                JTable target = (JTable) e.getSource();
                int row = target.getSelectedRow();
                int col = target.getSelectedColumn();
                if (col == 0) {
                    if (target.getModel() instanceof VariableModel) {
                        VariableModel vModel = (VariableModel) target.getModel();
                        String s = (String) vModel.getValueAt(row, col);

                        DatabaseName db = workspace.getDatabaseName();
                        DataTableName table = workspace.getCurrentDataTable();

                        RenameVariableDialog renameVariableDialog = new RenameVariableDialog(Jmetrik.this, db,
                                table, s);
                        renameVariableDialog.setVisible(true);

                        if (renameVariableDialog.canRun()) {
                            RenameVariableCommand command = renameVariableDialog.getCommand();
                            workspace.runProcess(command);
                        }

                    } //end instanceof

                } //end if col==0

            } //end if click count==2
        }//end mouse clicked
    });

    //change size of table header and center text
    JTableHeader variableHeader = variableTable.getTableHeader();
    variableHeader.setDefaultRenderer(new TableHeaderCellRenderer());
    variableHeader.setPreferredSize(new Dimension(30, 21));

    JScrollPane variableScrollPane = new JScrollPane(variableTable);
    tabbedPane.addTab("Variables", variableScrollPane);

    splitPane1.setRightComponent(tabbedPane);
    getContentPane().add(splitPane1, BorderLayout.CENTER);

    //add status bar listener - needed to display status message that are generated within this class
    this.addPropertyChangeListener(statusBar.getStatusListener());

    //add listener for displaying error messages - needed to display errors and exceptions
    this.addPropertyChangeListener(new ErrorOccurredPropertyChangeListener());

    //instantiate file utilities
    fileUtils = new JmetrikFileUtils();
    fileUtils.addPropertyChangeListener(statusBar.getStatusListener());

    //set import and export path to user's documents folder
    JFileChooser chooser = new JFileChooser();
    FileSystemView fw = chooser.getFileSystemView();
    importExportPath = fw.getDefaultDirectory().toString().replaceAll("\\\\", "/");

    //create and start a workspace
    startWorkspace();

    //create menu bar and tool bar
    this.setJMenuBar(createMenuBar());

    JToolBar toolBar = createToolBar();
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    getContentPane().add(toolBar, BorderLayout.PAGE_START);

    pack();

}

From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java

private void addResultPanel() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;//  w ww  . j  a va  2s . c om
    c.gridy = ++row;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.01;
    c.weighty = 0.01;
    c.anchor = GridBagConstraints.SOUTHEAST;
    c.gridwidth = GridBagConstraints.REMAINDER;
    resultPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    resultPanel.setDividerLocation(200);
    resultPanel.setBorder(null);
    runListModel = new DefaultListModel();
    runList = new JList(runListModel);
    runList.setBorder(new EmptyBorder(5, 5, 5, 5));
    runList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    runListPanel = new JPanel(new BorderLayout());
    runListPanel.setBorder(LineBorder.createGrayLineBorder());

    JLabel worklflowRunsLabel = new JLabel("Workflow Runs");
    worklflowRunsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
    removeCaGridRunsButton = new JButton("Remove"); // button to remove previous workflow runs
    removeCaGridRunsButton.setAlignmentX(JComponent.RIGHT_ALIGNMENT);
    removeCaGridRunsButton.setEnabled(false);
    removeCaGridRunsButton.setToolTipText("Remove caGrid run(s)");
    removeCaGridRunsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int[] selected = runList.getSelectedIndices();
            for (int i = selected.length - 1; i >= 0; i--) {
                CaGridRun cr = (CaGridRun) runListModel.get(selected[i]);

                //delete the EPR file
                File file = new File(new File(System.getProperty("user.home")), cr.workflowid + ".epr");
                file.delete();
                System.out.println(cr.workflowid + ".epr deleted");
                runListModel.remove(selected[i]);
            }
            // Set the first item as selected - if there is one
            if (runListModel.size() > 0) {
                runList.setSelectedIndex(0);
            } else {
                resultText.setText("");
                resultText.revalidate();

            }
        }
    });
    runListPanel.add(worklflowRunsLabel, BorderLayout.NORTH);
    runListPanel.add(removeCaGridRunsButton, BorderLayout.BEFORE_FIRST_LINE);

    JScrollPane scrollPane = new JScrollPane(runList);
    scrollPane.setBorder(null);
    runListPanel.add(scrollPane, BorderLayout.CENTER);
    // loadWorkflowRunsFromStoredEPRFiles(): add CaGridRun to runList for each EPR
    // add two buttons: remove and refresh status
    runList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                Object selection = runList.getSelectedValue();
                if (selection instanceof CaGridRun) {
                    removeCaGridRunsButton.setEnabled(true);
                    CaGridRun dataflowRun = (CaGridRun) selection;
                    // update status and refresh outputPanel
                    String resultDisplayString = updateResultDisplayString(dataflowRun);
                    resultText.setText(resultDisplayString);
                    resultText.setLineWrap(true);
                    resultText.setEditable(false);
                    outputPanel.revalidate();
                    revalidate();
                } else {
                    removeCaGridRunsButton.setEnabled(false);
                    revalidate();

                }
            }
        }
    });

    resultPanel.setTopComponent(runListPanel);

    //each output should be a (xml) string
    outputPanel = new JScrollPane();

    resultText = new JTextArea();
    outputPanel = new JScrollPane(resultText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    //outputPanel = new JPanel(new BorderLayout());
    outputPanel.setBorder(LineBorder.createGrayLineBorder());
    outputPanel.setBackground(Color.WHITE);
    //outputPanel.add(new JLabel("Workflow Execution Outputs shows here.", JLabel.CENTER), null);
    resultPanel.setBottomComponent(outputPanel);
    add(resultPanel, c);

    //add runComponent to the GUI
    ArrayList<CaGridRun> loadedRunList = loadWorkflowRunsFromStoredEPRFiles(null,
            (String) services.getSelectedItem());
    if (loadedRunList != null) {
        for (int m = 0; m < loadedRunList.size(); m++) {
            CaGridRun cr = (CaGridRun) loadedRunList.get(m);
            runListModel.add(0, cr);
        }
        System.out.println(loadedRunList.size() + " EPR loaded.");
        runList.setSelectedIndex(0);
    }

}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

JFrame showProgress(String message) {
    JFrame f = new JFrame("Info");
    f = new JFrame("Info");
    f.setUndecorated(true);//  w ww.java  2 s  .  c  om

    JPanel p = new JPanel();
    Border margin = new EmptyBorder(30, 20, 20, 20);
    p.setBorder(new TitledBorder(
            new TitledBorder(margin, "", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)),
            message, TitledBorder.LEADING, TitledBorder.TOP, null, null));
    p.setLayout(new BorderLayout(30, 30));
    JProgressBar progressBar = new JProgressBar();
    progressBar.setIndeterminate(true);
    p.add(progressBar, BorderLayout.CENTER);

    f.getContentPane().add(p);
    f.setSize(360, 80);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    return f;
}

From source file:com.apatar.ui.JPublishToApatarDialog.java

private void createDialog() {

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    this.setLayout(gridbag);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;//from  www. j av a2 s . co  m
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    //c.insets = new Insets(5, 5, 5, 5);

    JPanel panelLogin = new JPanel();
    panelLogin.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLogin.setLayout(new BoxLayout(panelLogin, BoxLayout.X_AXIS));
    panelLogin.add(new JLabel("User Name"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(username);
    username.setComponentPopupMenu(new JDefaultContextMenu(username));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(new JLabel("Password"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(password);

    JPanel panelForgotPassLink = new JPanel();
    panelForgotPassLink.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelForgotPassLink.setLayout(new BoxLayout(panelForgotPassLink, BoxLayout.X_AXIS));
    panelForgotPassLink.add(new JLabel("Lost your password? "));
    panelForgotPassLink.add(Box.createHorizontalStrut(5));
    panelForgotPassLink.add(forgotPassLinkLabel);

    forgotPassLinkLabel.setFont(UiUtils.NORMAL_SIZE_12_FONT);
    forgotPassLinkLabel.addMouseListener(new MouseHyperLinkEvent());
    forgotPassLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    forgotPassLinkLabel.setText(
            "<html><a href='http://www.apatarforge.org/profile/lostpassword.html'>Click here to retrieve it</a></html>");

    JPanel panelFile = new JPanel();
    panelFile.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelFile.setLayout(new BoxLayout(panelFile, BoxLayout.X_AXIS));
    panelFile.add(selectFromFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(new JLabel("New File "));
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(nameFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(browse);
    nameFile.setEnabled(false);
    nameFile.setComponentPopupMenu(new JDefaultContextMenu(nameFile));
    browse.setEnabled(false);

    JPanel panelLocation = new JPanel();
    panelLocation.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLocation.setLayout(new BoxLayout(panelLocation, BoxLayout.X_AXIS));
    panelLocation.add(new JLabel("Suggest Location:"));
    panelLocation.add(Box.createHorizontalStrut(5));
    panelLocation.add(location);

    JPanel panelDMName = new JPanel();
    panelDMName.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMName.setLayout(new BoxLayout(panelDMName, BoxLayout.X_AXIS));
    JLabel datamapNameLabel = new JLabel("DataMap Name:");
    datamapNameLabel.setBorder(new EmptyBorder(0, 0, 0, 10));
    panelDMName.add(datamapNameLabel);
    panelDMName.add(Box.createHorizontalStrut(5));
    panelDMName.add(dataMapName);
    dataMapName.setComponentPopupMenu(new JDefaultContextMenu(dataMapName));

    JPanel panelDMDescription = new JPanel();
    panelDMDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMDescription.setLayout(new BoxLayout(panelDMDescription, BoxLayout.X_AXIS));
    panelDMDescription.add(new JLabel("DataMap Description (16000 Chars)"));
    panelDMDescription.add(Box.createHorizontalStrut(5));
    //JScrollPane scroll = new JScrollPane(dataMapDescription);
    //scroll.setSize(300, 50);
    dataMapDescription.setLineWrap(true);
    dataMapDescription.setWrapStyleWord(true);
    panelDMDescription.add(new JScrollPane(dataMapDescription));

    JPanel panelDMShortDescription = new JPanel();
    panelDMShortDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMShortDescription.setLayout(new BoxLayout(panelDMShortDescription, BoxLayout.X_AXIS));
    JLabel labelShort = new JLabel("Short Description:");
    labelShort.setBorder(new EmptyBorder(0, 0, 0, 85));
    panelDMShortDescription.add(labelShort);
    panelDMShortDescription.add(Box.createHorizontalStrut(5));
    shortDescription.setLineWrap(true);
    shortDescription.setWrapStyleWord(true);
    panelDMShortDescription.add(new JScrollPane(shortDescription));
    setEnableShortDescription(false);

    // -------------

    JPanel panelTitleForTags = new JPanel();
    panelTitleForTags.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelTitleForTags.setLayout(new BoxLayout(panelTitleForTags, BoxLayout.X_AXIS));
    panelTitleForTags.add(new JLabel("Add tags associated with your DataMap:"));

    // -------------

    JPanel panelListAddedTags = new JPanel();
    panelListAddedTags.setBorder(new EmptyBorder(0, 10, 10, 10));
    panelListAddedTags.setLayout(new BoxLayout(panelListAddedTags, BoxLayout.X_AXIS));

    // --
    JPanel panelFrom = new JPanel();
    panelFrom.setLayout(new BoxLayout(panelFrom, BoxLayout.Y_AXIS));
    JPanel panelMiddle = new JPanel();
    panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.X_AXIS));
    JPanel panelTo = new JPanel();
    panelTo.setLayout(new BoxLayout(panelTo, BoxLayout.Y_AXIS));

    // --
    JPanel panelAddNewTag = new JPanel();
    panelAddNewTag.setLayout(new BoxLayout(panelAddNewTag, BoxLayout.X_AXIS));
    panelAddNewTag.add(new JLabel("Add new tag:"));
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    textfieldAddNewTag = new JTextField();
    textfieldAddNewTag.setComponentPopupMenu(new JDefaultContextMenu(textfieldAddNewTag));
    panelAddNewTag.add(textfieldAddNewTag);
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    JButton buttonAddTag = new JButton("Add");
    buttonAddTag.addActionListener(addNewTagMouseListener);
    panelAddNewTag.add(buttonAddTag);

    // --
    JPanel panelDeleteTags = new JPanel();
    panelDeleteTags.setLayout(new BoxLayout(panelDeleteTags, BoxLayout.X_AXIS));

    panelDeleteTags.add(new JLabel("Delete selected tag(s):"));
    panelDeleteTags.add(Box.createHorizontalStrut(5));
    JButton buttonDeleteTag = new JButton("Delete");
    buttonDeleteTag.addActionListener(deleteTagMouseListener);
    panelDeleteTags.add(buttonDeleteTag);
    panelDeleteTags.add(new JPanel());

    // --

    JButton moveTag = new JButton(UiUtils.ARROW_ICON);
    moveTag.addActionListener(addTagsMouseListener);
    panelMiddle.add(moveTag);

    tblModelFrom = new DefaultTableModel();
    tblModelTo = new DefaultTableModel();
    tblModelFrom.addColumn("Tag Name");
    tblModelTo.addColumn("Tag Name");

    tagsTableFrom = new JTable(tblModelFrom);
    tagsTableTo = new JTable(tblModelTo);

    tagsTableFrom.setOpaque(false);
    tagsTableFrom.setBackground(null);
    tagsTableFrom.setBorder(null);
    tagsTableFrom.setShowGrid(false);

    tagsTableTo.setOpaque(false);
    tagsTableTo.setBackground(null);
    tagsTableTo.setBorder(null);
    tagsTableTo.setShowGrid(false);

    tagsTableFrom.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));
    tagsTableTo.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));

    fillTableTags();

    tagsTableFrom.setComponentPopupMenu(new JDefaultContextMenu(tagsTableFrom));
    tagsTableTo.setComponentPopupMenu(new JDefaultContextMenu(tagsTableTo));

    JScrollPane srollPane = new JScrollPane(tagsTableFrom);
    srollPane.setBorder(null);

    JScrollPane srollPane2 = new JScrollPane(tagsTableTo);
    srollPane.setBorder(null);

    panelFrom.add(srollPane);
    panelFrom.add(Box.createVerticalStrut(5));
    panelFrom.add(panelAddNewTag);

    panelTo.add(srollPane2);
    panelTo.add(Box.createVerticalStrut(5));
    panelTo.add(panelDeleteTags);

    panelListAddedTags.add(panelFrom);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelMiddle);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelTo);

    // -------

    JPanel panelButton = new JPanel();
    panelButton.setLayout(new BoxLayout(panelButton, BoxLayout.X_AXIS));
    panelButton.add(Box.createHorizontalGlue());
    panelButton.add(bOk);
    panelButton.add(Box.createHorizontalStrut(5));
    panelButton.add(bCancel);
    panelButton.add(Box.createHorizontalStrut(5));

    ComponentBuilder.makeComponent(new JCommentPanel(), gridbag, c, getContentPane());

    ComponentBuilder.makeComponent(panelLogin, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelForgotPassLink, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelFile, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelLocation, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelDMName, gridbag, c, getContentPane());

    c.fill = GridBagConstraints.BOTH;

    c.weighty = 2.0;
    ComponentBuilder.makeComponent(panelDMDescription, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(autoGenerateShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelDMShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelTitleForTags, gridbag, c, getContentPane());

    c.weighty = 3.0;
    ComponentBuilder.makeComponent(panelListAddedTags, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(new JSeparator(), gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelButton, gridbag, c, getContentPane());
}

From source file:net.sf.keystore_explorer.gui.dialogs.DViewCertCsrPem.java

private void initComponents() throws CryptoException {
    jbOK = new JButton(res.getString("DViewCertCsrPem.jbOK.text"));

    jbOK.addActionListener(new ActionListener() {
        @Override/*from w w w  . j  a v a  2 s.c  o m*/
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });

    jbCopy = new JButton(res.getString("DViewCertCsrPem.jbCopy.text"));
    PlatformUtil.setMnemonic(jbCopy, res.getString("DViewCertCsrPem.jbCopy.mnemonic").charAt(0));
    if (cert != null) {
        jbCopy.setToolTipText(res.getString("DViewCertCsrPem.jbCertCopy.tooltip"));
    } else {
        jbCopy.setToolTipText(res.getString("DViewCertCsrPem.jbCsrCopy.tooltip"));
    }

    jbCopy.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCertCsrPem.this);
                copyPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCertCsrPem.this);
            }
        }
    });

    jbExport = new JButton(res.getString("DViewCertCsrPem.jbExport.text"));
    PlatformUtil.setMnemonic(jbExport, res.getString("DViewCertCsrPem.jbExport.mnemonic").charAt(0));
    if (cert != null) {
        jbExport.setToolTipText(res.getString("DViewCertCsrPem.jbCertExport.tooltip"));
    } else {
        jbExport.setToolTipText(res.getString("DViewCertCsrPem.jbCsrExport.tooltip"));
    }
    jbExport.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCertCsrPem.this);
                exportPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCertCsrPem.this);
            }
        }
    });

    jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, null, new JButton[] { jbCopy, jbExport }, true);

    jpPem = new JPanel(new BorderLayout());
    jpPem.setBorder(new EmptyBorder(5, 5, 5, 5));

    if (cert != null) {
        jtaPem = new JTextArea(X509CertUtil.getCertEncodedX509Pem(cert));
    } else {
        jtaPem = new JTextArea(Pkcs10Util.getCsrEncodedDerPem(pkcs10Csr));
    }
    jtaPem.setCaretPosition(0);
    jtaPem.setEditable(false);
    jtaPem.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
    // JGoodies - keep uneditable color same as editable
    jtaPem.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);

    jspPem = PlatformUtil.createScrollPane(jtaPem, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    jspPem.setPreferredSize(new Dimension(500, 300));
    jpPem.add(jspPem, BorderLayout.CENTER);

    getContentPane().add(jpPem, BorderLayout.CENTER);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);

    setResizable(true);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });

    getRootPane().setDefaultButton(jbOK);

    pack();

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jbOK.requestFocus();
        }
    });
}

From source file:projects.upc.exec.HrDiagram.java

/**
 * Main constructor.// w  w  w  .ja  v  a  2  s  . co m
 */
public HrDiagram() {

    List<UpcStar> upcStars = UpcUtils.loadUpcCatalogue();
    List<UpcStar> hipStars = UpcUtils.getHipparcosSubset(upcStars);
    List<UpcStar> unmatchedStars = UpcUtils.getUnmatchedSubset(upcStars);

    upcStarCrossMatches = XmUtil.getUpcStarCrossMatchMap(upcStars);
    hipStarCrossMatches = XmUtil.getUpcStarCrossMatchMap(hipStars);
    unmatchedStarCrossMatches = XmUtil.getUpcStarCrossMatchMap(unmatchedStars);

    logger.info("Loaded " + upcStarCrossMatches.size() + " UpcStars with SSA cross matches");
    logger.info("Loaded " + hipStarCrossMatches.size() + " UpcStars with Hipparcos and SSA cross matches");
    logger.info("Loaded " + unmatchedStarCrossMatches.size()
            + " UpcStars with no parallax cross-match, and with SSA cross matches");

    starsToPlot = upcStarCrossMatches;

    useHip = false;
    method = METHOD.NAIVE;
    fMax = 1.0;

    final JCheckBox plotAllCheckBox = new JCheckBox("Plot all UPC stars: ", true);
    plotAllCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (plotAllCheckBox.isSelected()) {
                starsToPlot = upcStarCrossMatches;
                updateChart();
            }
        }
    });

    final JCheckBox plotHipCheckBox = new JCheckBox("Plot Hipparcos stars only: ", false);
    plotHipCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (plotHipCheckBox.isSelected()) {
                starsToPlot = hipStarCrossMatches;
                updateChart();
            }
        }
    });

    final JCheckBox plotUnmatchedCheckBox = new JCheckBox("Plot all stars with no external match: ", false);
    plotUnmatchedCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (plotUnmatchedCheckBox.isSelected()) {
                starsToPlot = unmatchedStarCrossMatches;
                updateChart();
            }
        }
    });

    final ButtonGroup bg = new ButtonGroup();
    bg.add(plotHipCheckBox);
    bg.add(plotAllCheckBox);
    bg.add(plotUnmatchedCheckBox);

    JCheckBox useHipCheckBox = new JCheckBox("Use Hipparcos parallaxes when available", useHip);
    useHipCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            useHip = !useHip;
            updateChart();
        }
    });

    final JComboBox<METHOD> methodComboBox = new JComboBox<METHOD>(METHOD.values());
    methodComboBox.setSelectedItem(method);
    methodComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            method = (METHOD) methodComboBox.getSelectedItem();
            updateChart();
        }
    });

    final JSlider fSlider = GuiUtil.buildSlider(0.0, 2.0, 5, "%3.3f");
    fSlider.setValue((int) Math.rint(100.0 * fMax));
    final JLabel fLabel = new JLabel(getFLabel());
    // Create a change listener fot these
    ChangeListener cl = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();

            if (source == fSlider) {
                // Compute fractional parallax error from slider position
                double newF = (2.0 * source.getValue() / 100.0);
                fMax = newF;
                fLabel.setText(getFLabel());
            }
            updateChart();
        }
    };
    fSlider.addChangeListener(cl);
    // Add a bit of padding to space things out
    fSlider.setBorder(new EmptyBorder(5, 5, 5, 5));

    // Present controls below the HR diagram
    JPanel controls = new JPanel(new GridLayout(3, 3));
    controls.add(plotAllCheckBox);
    controls.add(plotHipCheckBox);
    controls.add(plotUnmatchedCheckBox);
    controls.add(new JLabel("Distance estimation method:"));
    controls.add(methodComboBox);
    controls.add(useHipCheckBox);
    controls.add(fLabel);
    controls.add(fSlider);

    // Initialise the ChartPanel
    updateChart();

    // Build the panel contents
    setLayout(new BorderLayout());
    add(chartPanel, BorderLayout.CENTER);
    add(controls, BorderLayout.SOUTH);
}