Example usage for javax.swing JLabel setLabelFor

List of usage examples for javax.swing JLabel setLabelFor

Introduction

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

Prototype

@BeanProperty(description = "The component this is labelling.")
public void setLabelFor(Component c) 

Source Link

Document

Set the component this is labelling.

Usage

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return/*w  w  w  .j a  v  a 2 s .  com*/
 */
private JPanel createEndGradientPanel() {
    GridBagConstraints itemConstraint;
    JPanel endGradientPanel = new JPanel(new GridBagLayout());

    // add gradient end label
    JLabel gradientEndLabel = new ResourceLabel(
            "plotter.configuration_dialog.color_scheme_dialog.gradient_end");
    {
        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1.0;
        itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
        itemConstraint.insets = new Insets(0, 2, 0, 0);

        endGradientPanel.add(gradientEndLabel, itemConstraint);
    }

    // add gradient end color combo box
    {
        gradientEndColorComboBox = new JComboBox<Color>(gradientEndColorComboBoxModel);
        gradientEndLabel.setLabelFor(gradientEndColorComboBox);
        gradientEndColorComboBox.setPreferredSize(preferredGradientComboBoxSize);
        gradientEndColorComboBox.setRenderer(new ColorRGBComboBoxCellRenderer());
        gradientEndColorComboBox.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                // set gradient end color to current active color scheme
                Color color = (Color) gradientEndColorComboBox.getSelectedItem();
                if (color != null && !adaptingModels) {

                    // enable apply and revert button
                    saveButton.setEnabled(true);
                    revertButton.setEnabled(true);

                    getCurrentActiveColorScheme().setGradientEndColor(ColorRGB.convertColorToColorRGB(color));
                }
                adaptGradientPlot();
                calculateGradientPreview();
            }

        });

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1.0;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER; // end row
        itemConstraint.insets = new Insets(0, 2, 0, 0);

        endGradientPanel.add(gradientEndColorComboBox, itemConstraint);
    }
    return endGradientPanel;
}

From source file:ffx.ui.ModelingPanel.java

private void loadCommand() {
    synchronized (this) {
        // Force Field X Command
        Element command;//from   w  ww  .  j  a v  a2s. c  om
        // Command Options
        NodeList options;
        Element option;
        // Option Values
        NodeList values;
        Element value;
        // Options may be Conditional based on previous Option values (not
        // always supplied)
        NodeList conditionalList;
        Element conditional;
        // JobPanel GUI Components that change based on command
        JPanel optionPanel;
        // Clear the previous components
        commandPanel.removeAll();
        optionsTabbedPane.removeAll();
        conditionals.clear();
        String currentCommand = (String) currentCommandBox.getSelectedItem();
        if (currentCommand == null) {
            commandPanel.validate();
            commandPanel.repaint();
            return;
        }
        command = null;
        for (int i = 0; i < commandList.getLength(); i++) {
            command = (Element) commandList.item(i);
            String name = command.getAttribute("name");
            if (name.equalsIgnoreCase(currentCommand)) {
                break;
            }
        }
        int div = splitPane.getDividerLocation();
        descriptTextArea.setText(currentCommand.toUpperCase() + ": " + command.getAttribute("description"));
        splitPane.setBottomComponent(descriptScrollPane);
        splitPane.setDividerLocation(div);
        // The "action" tells Force Field X what to do when the
        // command finishes
        commandActions = command.getAttribute("action").trim();
        // The "fileType" specifies what file types this command can execute
        // on
        String string = command.getAttribute("fileType").trim();
        String[] types = string.split(" +");
        commandFileTypes.clear();
        for (String type : types) {
            if (type.contains("XYZ")) {
                commandFileTypes.add(FileType.XYZ);
            }
            if (type.contains("INT")) {
                commandFileTypes.add(FileType.INT);
            }
            if (type.contains("ARC")) {
                commandFileTypes.add(FileType.ARC);
            }
            if (type.contains("PDB")) {
                commandFileTypes.add(FileType.PDB);
            }
            if (type.contains("ANY")) {
                commandFileTypes.add(FileType.ANY);
            }
        }
        // Determine what options are available for this command
        options = command.getElementsByTagName("Option");
        int length = options.getLength();
        for (int i = 0; i < length; i++) {
            // This Option will be enabled (isEnabled = true) unless a
            // Conditional disables it
            boolean isEnabled = true;
            option = (Element) options.item(i);
            conditionalList = option.getElementsByTagName("Conditional");
            /*
             * Currently, there can only be 0 or 1 Conditionals per Option
             * There are three types of Conditionals implemented. 1.)
             * Conditional on a previous Option, this option may be
             * available 2.) Conditional on input for this option, a
             * sub-option may be available 3.) Conditional on the presence
             * of keywords, this option may be available
             */
            if (conditionalList != null) {
                conditional = (Element) conditionalList.item(0);
            } else {
                conditional = null;
            }
            // Get the command line flag
            String flag = option.getAttribute("flag").trim();
            // Get the description
            String optionDescript = option.getAttribute("description");
            JTextArea optionTextArea = new JTextArea("  " + optionDescript.trim());
            optionTextArea.setEditable(false);
            optionTextArea.setLineWrap(true);
            optionTextArea.setWrapStyleWord(true);
            optionTextArea.setBorder(etchedBorder);
            // Get the default for this Option (if one exists)
            String defaultOption = option.getAttribute("default");
            // Option Panel
            optionPanel = new JPanel(new BorderLayout());
            optionPanel.add(optionTextArea, BorderLayout.NORTH);
            String swing = option.getAttribute("gui");
            JPanel optionValuesPanel = new JPanel(new FlowLayout());
            optionValuesPanel.setBorder(etchedBorder);
            ButtonGroup bg = null;
            if (swing.equalsIgnoreCase("CHECKBOXES")) {
                // CHECKBOXES allows selection of 1 or more values from a
                // predefined set (Analyze, for example)
                values = option.getElementsByTagName("Value");
                for (int j = 0; j < values.getLength(); j++) {
                    value = (Element) values.item(j);
                    JCheckBox jcb = new JCheckBox(value.getAttribute("name"));
                    jcb.addMouseListener(this);
                    jcb.setName(flag);
                    if (defaultOption != null && jcb.getActionCommand().equalsIgnoreCase(defaultOption)) {
                        jcb.setSelected(true);
                    }
                    optionValuesPanel.add(jcb);
                }
            } else if (swing.equalsIgnoreCase("TEXTFIELD")) {
                // TEXTFIELD takes an arbitrary String as input
                JTextField jtf = new JTextField(20);
                jtf.addMouseListener(this);
                jtf.setName(flag);
                if (defaultOption != null && defaultOption.equals("ATOMS")) {
                    FFXSystem sys = mainPanel.getHierarchy().getActive();
                    if (sys != null) {
                        jtf.setText("" + sys.getAtomList().size());
                    }
                } else if (defaultOption != null) {
                    jtf.setText(defaultOption);
                }
                optionValuesPanel.add(jtf);
            } else if (swing.equalsIgnoreCase("RADIOBUTTONS")) {
                // RADIOBUTTONS allows one choice from a set of predifined
                // values
                bg = new ButtonGroup();
                values = option.getElementsByTagName("Value");
                for (int j = 0; j < values.getLength(); j++) {
                    value = (Element) values.item(j);
                    JRadioButton jrb = new JRadioButton(value.getAttribute("name"));
                    jrb.addMouseListener(this);
                    jrb.setName(flag);
                    bg.add(jrb);
                    if (defaultOption != null && jrb.getActionCommand().equalsIgnoreCase(defaultOption)) {
                        jrb.setSelected(true);
                    }
                    optionValuesPanel.add(jrb);
                }
            } else if (swing.equalsIgnoreCase("PROTEIN")) {
                // Protein allows selection of amino acids for the protein
                // builder
                optionValuesPanel.setLayout(new BoxLayout(optionValuesPanel, BoxLayout.Y_AXIS));
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(getAminoAcidPanel());
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidComboBox.removeAllItems();
                JButton add = new JButton("Edit");
                add.setActionCommand("PROTEIN");
                add.addActionListener(this);
                add.setAlignmentX(Button.CENTER_ALIGNMENT);
                JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidTextField);
                comboPanel.add(add);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton remove = new JButton("Remove");
                add.setMinimumSize(remove.getPreferredSize());
                add.setPreferredSize(remove.getPreferredSize());
                remove.setActionCommand("PROTEIN");
                remove.addActionListener(this);
                remove.setAlignmentX(Button.CENTER_ALIGNMENT);
                comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidComboBox);
                comboPanel.add(remove);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(acidScrollPane);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton reset = new JButton("Reset");
                reset.setActionCommand("PROTEIN");
                reset.addActionListener(this);
                reset.setAlignmentX(Button.CENTER_ALIGNMENT);
                optionValuesPanel.add(reset);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidTextArea.setText("");
                acidTextField.setText("");
            } else if (swing.equalsIgnoreCase("NUCLEIC")) {
                // Nucleic allows selection of nucleic acids for the nucleic
                // acid builder
                optionValuesPanel.setLayout(new BoxLayout(optionValuesPanel, BoxLayout.Y_AXIS));
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(getNucleicAcidPanel());
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidComboBox.removeAllItems();
                JButton add = new JButton("Edit");
                add.setActionCommand("NUCLEIC");
                add.addActionListener(this);
                add.setAlignmentX(Button.CENTER_ALIGNMENT);
                JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidTextField);
                comboPanel.add(add);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton remove = new JButton("Remove");
                add.setMinimumSize(remove.getPreferredSize());
                add.setPreferredSize(remove.getPreferredSize());
                remove.setActionCommand("NUCLEIC");
                remove.addActionListener(this);
                remove.setAlignmentX(Button.CENTER_ALIGNMENT);
                comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidComboBox);
                comboPanel.add(remove);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(acidScrollPane);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton button = new JButton("Reset");
                button.setActionCommand("NUCLEIC");
                button.addActionListener(this);
                button.setAlignmentX(Button.CENTER_ALIGNMENT);
                optionValuesPanel.add(button);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidTextArea.setText("");
                acidTextField.setText("");
            } else if (swing.equalsIgnoreCase("SYSTEMS")) {
                // SYSTEMS allows selection of an open system
                JComboBox<FFXSystem> jcb = new JComboBox<>(mainPanel.getHierarchy().getNonActiveSystems());
                jcb.setSize(jcb.getMaximumSize());
                jcb.addActionListener(this);
                optionValuesPanel.add(jcb);
            }
            // Set up a Conditional for this Option
            if (conditional != null) {
                isEnabled = false;
                String conditionalName = conditional.getAttribute("name");
                String conditionalValues = conditional.getAttribute("value");
                String cDescription = conditional.getAttribute("description");
                String cpostProcess = conditional.getAttribute("postProcess");
                if (conditionalName.toUpperCase().startsWith("KEYWORD")) {
                    optionPanel.setName(conditionalName);
                    String keywords[] = conditionalValues.split(" +");
                    if (activeSystem != null) {
                        Hashtable<String, Keyword> systemKeywords = activeSystem.getKeywords();
                        for (String key : keywords) {
                            if (systemKeywords.containsKey(key.toUpperCase())) {
                                isEnabled = true;
                            }
                        }
                    }
                } else if (conditionalName.toUpperCase().startsWith("VALUE")) {
                    isEnabled = true;
                    // Add listeners to the values of this option so
                    // the conditional options can be disabled/enabled.
                    for (int j = 0; j < optionValuesPanel.getComponentCount(); j++) {
                        JToggleButton jtb = (JToggleButton) optionValuesPanel.getComponent(j);
                        jtb.addActionListener(this);
                        jtb.setActionCommand("Conditional");
                    }
                    JPanel condpanel = new JPanel();
                    condpanel.setBorder(etchedBorder);
                    JLabel condlabel = new JLabel(cDescription);
                    condlabel.setEnabled(false);
                    condlabel.setName(conditionalValues);
                    JTextField condtext = new JTextField(10);
                    condlabel.setLabelFor(condtext);
                    if (cpostProcess != null) {
                        condtext.setName(cpostProcess);
                    }
                    condtext.setEnabled(false);
                    condpanel.add(condlabel);
                    condpanel.add(condtext);
                    conditionals.add(condlabel);
                    optionPanel.add(condpanel, BorderLayout.SOUTH);
                } else if (conditionalName.toUpperCase().startsWith("REFLECTION")) {
                    String[] condModifiers;
                    if (conditionalValues.equalsIgnoreCase("AltLoc")) {
                        condModifiers = activeSystem.getAltLocations();
                        if (condModifiers != null && condModifiers.length > 1) {
                            isEnabled = true;
                            bg = new ButtonGroup();
                            for (int j = 0; j < condModifiers.length; j++) {
                                JRadioButton jrbmi = new JRadioButton(condModifiers[j]);
                                jrbmi.addMouseListener(this);
                                bg.add(jrbmi);
                                optionValuesPanel.add(jrbmi);
                                if (j == 0) {
                                    jrbmi.setSelected(true);
                                }
                            }
                        }
                    } else if (conditionalValues.equalsIgnoreCase("Chains")) {
                        condModifiers = activeSystem.getChainNames();
                        if (condModifiers != null && condModifiers.length > 0) {
                            isEnabled = true;
                            for (int j = 0; j < condModifiers.length; j++) {
                                JRadioButton jrbmi = new JRadioButton(condModifiers[j]);
                                jrbmi.addMouseListener(this);
                                bg.add(jrbmi);
                                optionValuesPanel.add(jrbmi, j);
                            }
                        }
                    }
                }
            }
            optionPanel.add(optionValuesPanel, BorderLayout.CENTER);
            optionPanel.setPreferredSize(optionPanel.getPreferredSize());
            optionsTabbedPane.addTab(option.getAttribute("name"), optionPanel);
            optionsTabbedPane.setEnabledAt(optionsTabbedPane.getTabCount() - 1, isEnabled);
        }
    }
    optionsTabbedPane.setPreferredSize(optionsTabbedPane.getPreferredSize());
    commandPanel.setLayout(borderLayout);
    commandPanel.add(optionsTabbedPane, BorderLayout.CENTER);
    commandPanel.validate();
    commandPanel.repaint();
    loadLogSettings();
    statusLabel.setText("  " + createCommandInput());
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return/*from  w  ww  .  j  av a 2s .c  o m*/
 */
private JPanel createStartGradientPanel() {
    GridBagConstraints itemConstraint;
    JPanel startGradientPanel = new JPanel(new GridBagLayout());

    // add gradient start label
    JLabel gradientStartLabel = new ResourceLabel(
            "plotter.configuration_dialog.color_scheme_dialog.gradient_start");
    {
        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
        itemConstraint.insets = new Insets(0, 5, 5, 5);

        startGradientPanel.add(gradientStartLabel, itemConstraint);
    }

    // add gradient start color combobox
    {
        gradientStartColorComboBox = new JComboBox<Color>(gradientStartColorComboBoxModel);
        gradientStartLabel.setLabelFor(gradientStartColorComboBox);
        gradientStartColorComboBox.setPreferredSize(preferredGradientComboBoxSize);
        gradientStartColorComboBox.setRenderer(new ColorRGBComboBoxCellRenderer());
        gradientStartColorComboBox.setEditable(false);
        gradientStartColorComboBox.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                // set gradient start color at current active color scheme
                Color color = (Color) gradientStartColorComboBox.getSelectedItem();
                if (color != null && !adaptingModels) {

                    // enable apply and revert button
                    saveButton.setEnabled(true);
                    revertButton.setEnabled(true);

                    getCurrentActiveColorScheme().setGradientStartColor(ColorRGB.convertColorToColorRGB(color));
                }
                adaptGradientPlot();
                calculateGradientPreview();
            }

        });

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1.0;
        itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
        // itemConstraint.fill = GridBagConstraints.HORIZONTAL;
        // itemConstraint.insets = new Insets(0, 5, 5, 5);

        startGradientPanel.add(gradientStartColorComboBox, itemConstraint);
    }
    return startGradientPanel;
}

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

/**
 * Create the frame.//from  www  .  j  a  va2 s.c  om
 */
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:bazaar4idea.ui.BzrPushDialog.java

/** Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 * @noinspection ALL//  ww w.  j  ava  2s. co  m
 */
private void $$$setupUI$$$() {
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.add(panel1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setText("Destination Repository URL:");
    label1.setDisplayedMnemonic('D');
    label1.setDisplayedMnemonicIndex(0);
    panel1.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    repositoryTxt = new JTextField();
    panel1.add(repositoryTxt,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel2,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    new Dimension(-1, 100), null, null, 0, false));
    panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Options"));
    revisionCbx = new JCheckBox();
    revisionCbx.setText("Revision");
    revisionCbx.setMnemonic('R');
    revisionCbx.setDisplayedMnemonicIndex(0);
    panel2.add(revisionCbx,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    revisionTxt = new JTextField();
    revisionTxt.setEnabled(false);
    revisionTxt.setText("tip");
    panel2.add(revisionTxt,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final Spacer spacer2 = new Spacer();
    panel2.add(spacer2,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    final Spacer spacer3 = new Spacer();
    panel2.add(spacer3,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    hgRepositorySelectorComponent = new BzrRepositorySelectorComponent();
    panel1.add(hgRepositorySelectorComponent.$$$getRootComponent$$$(),
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    label1.setLabelFor(repositoryTxt);
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return/*from   w  ww. ja va2s. c o m*/
 */
private JPanel createColorCategoriesPanel() {
    JPanel categoryColorsConfigurationPanel = new JPanel(new GridBagLayout());
    categoryColorsConfigurationPanel.setPreferredSize(new Dimension(180, 200));

    GridBagConstraints itemConstraint = new GridBagConstraints();

    JLabel categoryColorsLabel = new ResourceLabel(
            "plotter.configuration_dialog.color_scheme_dialog.category_colors");
    {

        itemConstraint.fill = GridBagConstraints.HORIZONTAL;
        itemConstraint.anchor = GridBagConstraints.WEST;
        itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
        itemConstraint.insets = new Insets(0, 5, 5, 5);
        itemConstraint.weightx = 1.0;

        categoryColorsConfigurationPanel.add(categoryColorsLabel, itemConstraint);
    }

    // add button panel
    {
        JPanel buttonPanel = new JPanel(new GridBagLayout());

        // remove scheme button
        {
            removeCategoryColorButton = new JButton(new ResourceAction(true,
                    "plotter.configuration_dialog.color_scheme_dialog.remove_category_color_button") {

                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    removeSelectedColorAction();
                }

            });

            itemConstraint = new GridBagConstraints();
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.fill = GridBagConstraints.NONE;

            buttonPanel.add(removeCategoryColorButton, itemConstraint);
        }

        {
            addCategoryButton = new JButton(new ResourceAction(true,
                    "plotter.configuration_dialog.color_scheme_dialog.add_category_color_button") {

                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    Color oldColor = Color.white;
                    Color newSchemeColor = createColorDialog(oldColor);
                    if (newSchemeColor != null && !newSchemeColor.equals(oldColor)) {
                        addColorAction(newSchemeColor);
                    }
                }

            });

            itemConstraint = new GridBagConstraints();
            itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
            itemConstraint.fill = GridBagConstraints.NONE;

            buttonPanel.add(addCategoryButton, itemConstraint);

        }

        itemConstraint = new GridBagConstraints();
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.anchor = GridBagConstraints.EAST;
        itemConstraint.insets = new Insets(0, 5, 5, 5);

        categoryColorsConfigurationPanel.add(buttonPanel, itemConstraint);
    }

    {

        JPanel categoryListPanel = new JPanel(new GridBagLayout());

        // add list of categorie colors
        {

            colorList = new JList<Color>(nominalColorListModel);
            categoryColorsLabel.setLabelFor(colorList);
            colorList.setCellRenderer(new ColorListCellRenderer());
            colorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

            MouseAdapter ma = new MouseAdapter() {

                private void myPopupEvent(MouseEvent e) {
                    int x = e.getX();
                    int y = e.getY();
                    JList<?> list = (JList<?>) e.getSource();
                    list.setSelectedIndex(list.locationToIndex(e.getPoint()));
                    Color selectedColor = (Color) list.getSelectedValue();
                    if (selectedColor == null) {
                        return;
                    }

                    removeMenuItem.setEnabled(nominalColorListModel.getSize() > 2);

                    popupMenu.show(list, x, y);
                }

                @Override
                public void mousePressed(MouseEvent e) {
                    if (e.isPopupTrigger()) {
                        myPopupEvent(e);
                    }
                }

                @Override
                public void mouseReleased(MouseEvent e) {
                    if (e.isPopupTrigger()) {
                        myPopupEvent(e);
                    }
                }
            };

            colorList.addMouseListener(ma);
            colorList.addKeyListener(new KeyListener() {

                @Override
                public void keyTyped(KeyEvent e) {
                    return; // Nothing to be done
                }

                @Override
                public void keyReleased(KeyEvent e) {
                    return; // Nothing to be done
                }

                @Override
                public void keyPressed(KeyEvent e) {
                    int key = e.getKeyCode();
                    if (key == KeyEvent.VK_DELETE) {
                        if (nominalColorListModel.getSize() > 2) {
                            removeSelectedColorAction();
                        }
                    }
                    if (key == KeyEvent.VK_F2) {
                        replaceSelectedColorAction();
                    }
                    if (key == KeyEvent.VK_UP && SwingTools.isControlOrMetaDown(e)) {
                        moveSelectedColorUpAction();
                    }
                    if (key == KeyEvent.VK_DOWN && SwingTools.isControlOrMetaDown(e)) {
                        moveSelectedColorDownAction();
                    }
                }
            });

            colorListScrollPane = new JScrollPane(colorList);
            colorListScrollPane.setPreferredSize(new Dimension(170, 200));
            colorListScrollPane.setMaximumSize(new Dimension(170, 200));
            colorListScrollPane.setMinimumSize(new Dimension(170, 180));
            colorListScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            colorListScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

            itemConstraint = new GridBagConstraints();
            itemConstraint.fill = GridBagConstraints.BOTH;
            itemConstraint.weightx = 0.0;
            itemConstraint.weighty = 0.5;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;

            categoryListPanel.add(colorListScrollPane, itemConstraint);
        }

        // add up/down button panel
        {

            JPanel upAndDownButtonPanel = new JPanel(new GridBagLayout());

            // add up button
            {
                JButton upButton = new JButton(
                        new ResourceAction(true, "plotter.configuration_dialog.move_color_up") {

                            private static final long serialVersionUID = 1L;

                            @Override
                            public void actionPerformed(ActionEvent e) {
                                moveSelectedColorUpAction();
                            }
                        });

                itemConstraint = new GridBagConstraints();
                itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
                itemConstraint.weightx = 0;
                itemConstraint.weighty = 0;
                itemConstraint.fill = GridBagConstraints.NONE;
                itemConstraint.insets = new Insets(0, 2, 0, 12);

                upAndDownButtonPanel.add(upButton, itemConstraint);
            }

            // add down button
            {
                JButton downButton = new JButton(
                        new ResourceAction(true, "plotter.configuration_dialog.move_color_down") {

                            private static final long serialVersionUID = 1L;

                            @Override
                            public void actionPerformed(ActionEvent e) {
                                moveSelectedColorDownAction();
                            }
                        });

                itemConstraint = new GridBagConstraints();
                itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
                itemConstraint.weightx = 0;
                itemConstraint.weighty = 0;
                itemConstraint.fill = GridBagConstraints.NONE;
                itemConstraint.insets = new Insets(0, 2, 0, 12);

                upAndDownButtonPanel.add(downButton, itemConstraint);
            }

            // add spacer panel
            {
                JPanel spacer = new JPanel();

                itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
                itemConstraint.weightx = 0;
                itemConstraint.weighty = 1;
                itemConstraint.fill = GridBagConstraints.VERTICAL;

                upAndDownButtonPanel.add(spacer, itemConstraint);

            }

            itemConstraint = new GridBagConstraints();
            itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
            itemConstraint.weightx = 1;
            itemConstraint.weighty = 1;
            itemConstraint.fill = GridBagConstraints.VERTICAL;

            categoryListPanel.add(upAndDownButtonPanel, itemConstraint);

        }

        itemConstraint = new GridBagConstraints();
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;

        categoryColorsConfigurationPanel.add(categoryListPanel, itemConstraint);
    }

    return categoryColorsConfigurationPanel;
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return//from  w ww  . j a  v a  2  s  . co  m
 */
private JPanel createSchemeComboBoxPanel() {
    JPanel schemeListPanel = new JPanel(new GridBagLayout());

    // create categories configuration panel
    {

        GridBagConstraints itemConstraint = new GridBagConstraints();

        // Add active scheme label
        JLabel actviceSchemeLabel = new ResourceLabel(
                "plotter.configuration_dialog.color_scheme_dialog.active_scheme");
        {
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;
            itemConstraint.anchor = GridBagConstraints.WEST;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.insets = new Insets(0, 5, 5, 5);
            itemConstraint.weightx = 1.0;

            actviceSchemeLabel.setBackground(Color.red);

            schemeListPanel.add(actviceSchemeLabel, itemConstraint);
        }

        // add button panel
        {
            JPanel buttonPanel = new JPanel(new GridBagLayout());

            // rename scheme button
            {
                renameSchemeButton = new JButton(new ResourceAction(true,
                        "plotter.configuration_dialog.color_scheme_dialog.rename_scheme_button") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        String newName = createNameDialog(currentActiveColorSchemeName);
                        if (newName != null && !newName.equals(currentActiveColorSchemeName)) {
                            renameColorSchemeAction(newName);
                        }
                    }

                });

                itemConstraint = new GridBagConstraints();
                itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
                itemConstraint.fill = GridBagConstraints.NONE;

                buttonPanel.add(renameSchemeButton, itemConstraint);
            }

            // remove scheme button
            {
                removeSchemeButton = new JButton(new ResourceAction(true,
                        "plotter.configuration_dialog.color_scheme_dialog.remove_scheme_button") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        ConfirmDialog dialog = new ConfirmDialog(
                                SwingUtilities.getWindowAncestor((Component) e.getSource()),
                                "plotter.configuration_dialog.confirm_color_scheme_delete",
                                ConfirmDialog.YES_NO_OPTION, false);
                        dialog.setLocationRelativeTo((Component) e.getSource());
                        dialog.setVisible(true);
                        if (dialog.getReturnOption() == ConfirmDialog.YES_OPTION) {
                            removeColorSchemeAction((ColorScheme) colorSchemeComboBox.getSelectedItem());
                        }
                    }

                });

                itemConstraint = new GridBagConstraints();
                itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
                itemConstraint.fill = GridBagConstraints.NONE;

                buttonPanel.add(removeSchemeButton, itemConstraint);
            }

            itemConstraint = new GridBagConstraints();
            itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
            itemConstraint.fill = GridBagConstraints.NONE;
            itemConstraint.anchor = GridBagConstraints.EAST;
            itemConstraint.insets = new Insets(0, 5, 5, 5);

            schemeListPanel.add(buttonPanel, itemConstraint);

        }

        {

            colorSchemeComboBox = new JComboBox(colorSchemeComboBoxModel);
            actviceSchemeLabel.setLabelFor(colorSchemeComboBox);
            colorSchemeComboBox.setRenderer(new ColorSchemeComboBoxRenderer());
            colorSchemeComboBox.addPopupMenuListener(new PopupMenuListener() {

                @Override
                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                    return;

                }

                @Override
                public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                    Object selectedValue = colorSchemeComboBox.getSelectedItem();
                    if (selectedValue instanceof ColorScheme) {
                        ColorScheme selection = (ColorScheme) selectedValue;
                        if (selection != null) {
                            if (!currentActiveColorSchemeName.equals(selection.getName())) {
                                currentActiveColorSchemeName = selection.getName();
                                adaptModels();
                            }
                        }
                    } else {
                        String newName = I18N.getGUILabel("plotter.new_color_scheme_name.label");
                        String suffix = "";
                        int counter = 1;
                        while (currentColorSchemes.get(newName + suffix) != null) {
                            suffix = "_" + counter;
                            counter++;
                        }
                        newName += suffix;
                        String userSelectedName = createNameDialog(newName);
                        if (userSelectedName == null) {
                            colorSchemeComboBox.setSelectedItem(getCurrentActiveColorScheme());
                            return;
                        }
                        addNewColorSchemeAction(userSelectedName);
                    }
                }

                @Override
                public void popupMenuCanceled(PopupMenuEvent e) {
                    return;
                }
            });

            itemConstraint = new GridBagConstraints();
            itemConstraint.fill = GridBagConstraints.BOTH;
            itemConstraint.weightx = 0.0;
            itemConstraint.weighty = 0.0;
            itemConstraint.gridwidth = GridBagConstraints.REMAINDER;

            schemeListPanel.add(colorSchemeComboBox, itemConstraint);
        }

    }
    return schemeListPanel;
}

From source file:com.atlassian.theplugin.idea.config.serverconfig.GenericServerConfigForm.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from   w w w.  ja  va  2s. co  m
 */
private void $$$setupUI$$$() {
    rootComponent = new JPanel();
    rootComponent.setLayout(new GridBagLayout());
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(7, 3, new Insets(0, 0, 0, 0), -1, -1));
    GridBagConstraints gbc;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    rootComponent.add(panel1, gbc);
    serverName = new JTextField();
    serverName.setText("");
    panel1.add(serverName,
            new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setHorizontalAlignment(4);
    label1.setHorizontalTextPosition(4);
    label1.setText("Server Name:");
    label1.setDisplayedMnemonic('S');
    label1.setDisplayedMnemonicIndex(0);
    panel1.add(label1,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(80, -1),
                    new Dimension(92, 16), null, 0, false));
    serverUrl = new JTextField();
    panel1.add(serverUrl,
            new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    username = new JTextField();
    panel1.add(username,
            new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    password = new JPasswordField();
    panel1.add(password,
            new GridConstraints(4, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setHorizontalAlignment(4);
    label2.setText("Server URL:");
    label2.setDisplayedMnemonic('U');
    label2.setDisplayedMnemonicIndex(7);
    panel1.add(label2,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(80, -1),
                    new Dimension(92, 16), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setHorizontalAlignment(4);
    label3.setText("Username:");
    label3.setDisplayedMnemonic('N');
    label3.setDisplayedMnemonicIndex(4);
    panel1.add(label3,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(92, 16), null, 0, false));
    final JLabel label4 = new JLabel();
    label4.setHorizontalAlignment(4);
    label4.setText("Password:");
    label4.setDisplayedMnemonic('P');
    label4.setDisplayedMnemonicIndex(0);
    panel1.add(label4,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(92, 16), null, 0, false));
    testConnection = new JButton();
    testConnection.setText("Test Connection");
    testConnection.setMnemonic('T');
    testConnection.setDisplayedMnemonicIndex(0);
    panel1.add(testConnection,
            new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_NORTHEAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    //      chkPasswordRemember = new JCheckBox();
    //      chkPasswordRemember.setSelected(true);
    //      chkPasswordRemember.setText("Remember Password");
    //      chkPasswordRemember.setMnemonic('R');
    //      chkPasswordRemember.setDisplayedMnemonicIndex(0);
    //      panel1.add(chkPasswordRemember, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
    //            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED,
    //            null, null, null, 0, false));
    cbEnabled = new JCheckBox();
    cbEnabled.setEnabled(false);
    cbEnabled.setHorizontalTextPosition(11);
    cbEnabled.setText("Server Enabled");
    cbEnabled.setMnemonic('E');
    cbEnabled.setDisplayedMnemonicIndex(7);
    panel1.add(cbEnabled,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 25), null, 0, false));
    useDefault = new JCheckBox();
    useDefault.setText("Use Default Credentials");
    panel1.add(useDefault,
            new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel spacer1 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.VERTICAL;
    rootComponent.add(spacer1, gbc);
    label1.setLabelFor(serverName);
    label2.setLabelFor(serverUrl);
    label3.setLabelFor(username);
    label4.setLabelFor(password);
}

From source file:com.atlassian.theplugin.idea.jira.IssueCreateDialog.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL// w w  w.  java2  s  .c  o m
 */
private void $$$setupUI$$$() {
    mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayoutManager(10, 3, new Insets(5, 5, 5, 5), -1, -1));
    mainPanel.setMinimumSize(new Dimension(480, 500));
    final JScrollPane scrollPane1 = new JScrollPane();
    mainPanel.add(scrollPane1,
            new GridConstraints(7, 1, 2, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    description = new JTextArea();
    description.setLineWrap(true);
    description.setWrapStyleWord(true);
    scrollPane1.setViewportView(description);
    final JLabel label1 = new JLabel();
    label1.setText("Summary:");
    mainPanel.add(label1,
            new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label2 = new JLabel();
    label2.setText("Project:");
    mainPanel.add(label2,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    projectComboBox = new JComboBox();
    mainPanel.add(projectComboBox,
            new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), null, null, 0, false));
    summary = new JTextField();
    mainPanel.add(summary,
            new GridConstraints(6, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("Description:");
    mainPanel.add(label3,
            new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_NORTHEAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label4 = new JLabel();
    label4.setText("Assignee:");
    mainPanel.add(label4,
            new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label5 = new JLabel();
    label5.setFont(new Font(label5.getFont().getName(), label5.getFont().getStyle(), 10));
    label5.setHorizontalTextPosition(10);
    label5.setText("Warning! This field is not validated prior to sending to JIRA");
    mainPanel.add(label5,
            new GridConstraints(9, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label6 = new JLabel();
    label6.setText("Type:");
    mainPanel.add(label6,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    typeComboBox = new JComboBox();
    mainPanel.add(typeComboBox,
            new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label7 = new JLabel();
    label7.setText("Priority:");
    mainPanel.add(label7,
            new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    priorityComboBox = new JComboBox();
    mainPanel.add(priorityComboBox,
            new GridConstraints(5, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), null, null, 0, false));
    final JLabel label8 = new JLabel();
    label8.setText("Component/s:");
    mainPanel.add(label8,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTHEAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JScrollPane scrollPane2 = new JScrollPane();
    mainPanel.add(scrollPane2,
            new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    componentsList = new JList();
    componentsList.setToolTipText("Select Affected Components ");
    componentsList.setVisibleRowCount(5);
    scrollPane2.setViewportView(componentsList);
    final JLabel label9 = new JLabel();
    label9.setText("Affects Version/s:");
    mainPanel.add(label9,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JScrollPane scrollPane3 = new JScrollPane();
    mainPanel.add(scrollPane3,
            new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    versionsList = new JList();
    versionsList.setVisibleRowCount(5);
    scrollPane3.setViewportView(versionsList);
    final JScrollPane scrollPane4 = new JScrollPane();
    mainPanel.add(scrollPane4,
            new GridConstraints(4, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    fixVersionsList = new JList();
    fixVersionsList.setVisible(true);
    fixVersionsList.setVisibleRowCount(5);
    scrollPane4.setViewportView(fixVersionsList);
    final JLabel label10 = new JLabel();
    label10.setText("Fix Version/s:");
    mainPanel.add(label10,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_NORTHEAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    label1.setLabelFor(summary);
    label2.setLabelFor(projectComboBox);
    label3.setLabelFor(description);
    label6.setLabelFor(typeComboBox);
}

From source file:nz.ac.waikato.cms.supernova.gui.Supernova.java

/**
 * Creates a panel with a parameter.//from  w  ww .j  a  v  a2s  .co  m
 *
 * @param labelText   the label text
 * @param comp   the component
 * @return      the panel
 */
protected JPanel createParameter(String labelText, JComponent comp) {
    JPanel param;
    JLabel label;

    label = new JLabel(labelText);
    label.setLabelFor(comp);
    param = new JPanel(new FlowLayout(FlowLayout.LEFT));
    param.add(label);
    param.add(comp);
    m_ParamLabels.add(label);

    return param;
}