Example usage for javax.swing JButton setActionCommand

List of usage examples for javax.swing JButton setActionCommand

Introduction

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

Prototype

public void setActionCommand(String actionCommand) 

Source Link

Document

Sets the action command for this button.

Usage

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

private void init() {
    setBounds(100, 100, 450, 560);//  w w w  .java 2 s . com
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new GridLayout(0, 2, 0, 0));
    {
        JLabel lblLatitude = new JLabel("Latitude");
        lblLatitude.setHorizontalAlignment(SwingConstants.RIGHT);
        contentPanel.add(lblLatitude);
    }

    textFieldDecimalLat = new JTextField();
    contentPanel.add(textFieldDecimalLat);
    textFieldDecimalLat.setColumns(10);

    JLabel lblLongitude = new JLabel("Longitude");
    lblLongitude.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongitude);
    {
        textFieldDecimalLong = new JTextField();
        contentPanel.add(textFieldDecimalLong);
        textFieldDecimalLong.setColumns(10);
    }
    {
        JLabel lblDatum = new JLabel("Datum");
        lblDatum.setHorizontalAlignment(SwingConstants.RIGHT);
        contentPanel.add(lblDatum);
    }

    @SuppressWarnings("unchecked")
    ComboBoxModel<String> datumModel = new ListComboBoxModel<String>(LatLong.getDatumValues());
    cbDatum = new JComboBox<String>(datumModel);
    contentPanel.add(cbDatum);

    JLabel lblMethod = new JLabel("Method");
    lblMethod.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblMethod);

    @SuppressWarnings("unchecked")
    ComboBoxModel<String> methodModel = new ListComboBoxModel<String>(LatLong.getGeorefMethodValues());
    cbMethod = new JComboBox<String>(new DefaultComboBoxModel<String>(new String[] { "not recorded", "unknown",
            "GEOLocate", "Google Earth", "Gazeteer", "GPS", "MaNIS/HertNet/ORNIS Georeferencing Guidelines" }));
    cbMethod.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setState();
        }
    });
    contentPanel.add(cbMethod);

    JLabel lblAccuracy = new JLabel("GPS Accuracy");
    lblAccuracy.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblAccuracy);

    txtGPSAccuracy = new JTextField();
    txtGPSAccuracy.setColumns(10);
    contentPanel.add(txtGPSAccuracy);

    JLabel lblNewLabel_1 = new JLabel("Original Units");
    lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblNewLabel_1);

    comboBoxOrigUnits = new JComboBox<String>();
    comboBoxOrigUnits.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setState();
        }
    });
    comboBoxOrigUnits.setModel(new DefaultComboBoxModel<String>(
            new String[] { "decimal degrees", "deg. min. sec.", "degrees dec. minutes", "unknown" }));
    contentPanel.add(comboBoxOrigUnits);

    lblErrorRadius = new JLabel("Error Radius");
    lblErrorRadius.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblErrorRadius);

    txtErrorRadius = new JTextField();
    txtErrorRadius.setColumns(10);
    contentPanel.add(txtErrorRadius);

    JLabel lblErrorRadiusUnits = new JLabel("Error Radius Units");
    lblErrorRadiusUnits.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblErrorRadiusUnits);

    comboBoxErrorUnits = new JComboBox<String>();
    comboBoxErrorUnits.setModel(new DefaultComboBoxModel<String>(new String[] { "m", "ft", "km", "mi", "yd" }));
    contentPanel.add(comboBoxErrorUnits);

    JLabel lblLatDegrees = new JLabel("Lat Degrees");
    lblLatDegrees.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatDegrees);

    txtLatDegrees = new JTextField();
    txtLatDegrees.setColumns(4);
    contentPanel.add(txtLatDegrees);

    JLabel lblLatDecMin = new JLabel("Lat Dec Min");
    lblLatDecMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatDecMin);

    txtLatDecMin = new JTextField();
    txtLatDecMin.setColumns(6);
    contentPanel.add(txtLatDecMin);

    JLabel lblLatMin = new JLabel("Lat Min");
    lblLatMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatMin);

    txtLatMin = new JTextField();
    txtLatMin.setColumns(6);
    contentPanel.add(txtLatMin);

    JLabel lblLatSec = new JLabel("Lat Sec");
    lblLatSec.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatSec);

    txtLatSec = new JTextField();
    txtLatSec.setColumns(6);
    contentPanel.add(txtLatSec);

    JLabel lblLatDir = new JLabel("Lat N/S");
    lblLatDir.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatDir);

    cbLatDir = new JComboBox<String>();
    cbLatDir.setModel(new DefaultComboBoxModel<String>(new String[] { "N", "S" }));
    contentPanel.add(cbLatDir);

    JLabel lblLongDegrees = new JLabel("Long Degrees");
    lblLongDegrees.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongDegrees);

    txtLongDegrees = new JTextField();
    txtLongDegrees.setColumns(4);
    contentPanel.add(txtLongDegrees);

    JLabel lblLongDecMin = new JLabel("Long Dec Min");
    lblLongDecMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongDecMin);

    txtLongDecMin = new JTextField();
    txtLongDecMin.setColumns(6);
    contentPanel.add(txtLongDecMin);

    JLabel lblLongMin = new JLabel("Long Min");
    lblLongMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongMin);

    txtLongMin = new JTextField();
    txtLongMin.setColumns(6);
    contentPanel.add(txtLongMin);

    JLabel lblLongSec = new JLabel("Long Sec");
    lblLongSec.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongSec);

    txtLongSec = new JTextField();
    txtLongSec.setColumns(6);
    contentPanel.add(txtLongSec);

    JLabel lblLongDir = new JLabel("Long E/W");
    lblLongDir.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongDir);

    cbLongDir = new JComboBox<String>();
    cbLongDir.setModel(new DefaultComboBoxModel<String>(new String[] { "E", "W" }));
    contentPanel.add(cbLongDir);

    JLabel lblDetBy = new JLabel("Determined By");
    lblDetBy.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblDetBy);

    textFieldDetBy = new JTextField();
    contentPanel.add(textFieldDetBy);
    textFieldDetBy.setColumns(10);

    JLabel lblDetDate = new JLabel("Date Determined");
    lblDetDate.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblDetDate);

    try {
        textDetDate = new JFormattedTextField(new MaskFormatter("####-##-##"));
    } catch (ParseException e1) {
        textDetDate = new JFormattedTextField();
    }
    textDetDate.setToolTipText("Date on which georeference was made yyyy-mm-dd");
    contentPanel.add(textDetDate);

    JLabel lblRef = new JLabel("Reference Source");
    lblRef.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblRef);

    textRefSource = new JTextField();
    contentPanel.add(textRefSource);
    textRefSource.setColumns(10);

    lblNewLabel = new JLabel("Remarks");
    lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblNewLabel);

    textFieldRemarks = new JTextField();
    contentPanel.add(textFieldRemarks);
    textFieldRemarks.setColumns(10);

    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            lblErrorLabel = new JLabel("Message");
            buttonPane.add(lblErrorLabel);
        }
        {
            okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    lblErrorLabel.setText("");

                    if (saveData()) {
                        setVisible(false);
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    loadData();
                    setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}

From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java

private JPanel createCurvesPanel() {
    JPanel wrap = new JPanel(new BorderLayout());
    JPanel curves = new JPanel(new BorderLayout());
    curves.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    JPanel general = new JPanel(new BorderLayout());
    general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "General"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Show Marker"));
    showMarker = new JCheckBox();
    showMarker.setActionCommand(SHOW_MARKER_COMMAND);
    showMarker.addActionListener(this);
    inner.add(showMarker);/*from  w  ww  . j a  v  a  2 s. c o m*/
    inner.add(new JLabel());

    inner.add(new JLabel("Show Error"));
    showError = new JCheckBox();
    showError.setActionCommand(SHOW_ERROR_COMMAND);
    showError.addActionListener(this);
    inner.add(showError);
    inner.add(new JLabel());

    general.add(inner, BorderLayout.NORTH);
    curves.add(general, BorderLayout.NORTH);

    JPanel individual = new JPanel(new BorderLayout());
    individual.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Individual"));

    JPanel interior = new JPanel(new LCBLayout(6));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    XYDataset dataset = chart.getXYPlot().getDataset();
    int numberOfSeries = dataset.getSeriesCount();
    String[] seriesNames = new String[numberOfSeries];
    currentSeriesIndex = -1;
    for (int i = 0; i < numberOfSeries; i++) {
        seriesNames[i] = (String) dataset.getSeriesKey(i);
        if (seriesNames[i].equals(currentSeriesKey)) {
            currentSeriesIndex = i;
        }
    }
    if (currentSeriesIndex < 0 && seriesNames.length > 0) {
        currentSeriesIndex = 0;
        currentSeriesKey = seriesNames[currentSeriesIndex];
    }

    //Select curve combo
    this.seriesCombo = new JComboBox(seriesNames);
    seriesCombo.setActionCommand(CHANGE_CURVE_COMMAND);
    seriesCombo.addActionListener(this);
    interior.add(new JLabel("Select Curve"));
    interior.add(seriesCombo);
    interior.add(new JLabel(""));

    interior.add(new JLabel("Curve Stroke"));
    curveStrokeSample = new StrokeSample(new BasicStroke());
    curveStrokeSample.setEnabled(false);
    interior.add(curveStrokeSample);
    //      JButton button = new JButton(localizationResources.getString("Edit..."));
    Float[] strokes = new Float[] { 0f, 0.2f, 0.5f, 1f, 1.5f, 2f, 3f };
    strokeCombo = new JComboBox(strokes);
    strokeCombo.setActionCommand(CURVE_STROCK_COMMAND);
    strokeCombo.addActionListener(this);
    interior.add(strokeCombo);

    interior.add(new JLabel("Curve Colour"));
    curveColorPaint = new PaintSample(chart.getBackgroundPaint());
    interior.add(curveColorPaint);
    JButton button = new JButton(localizationResources.getString("Edit..."));
    button.setActionCommand(CURVE_COLOR_COMMAND);
    button.addActionListener(this);
    interior.add(button);

    interior.add(new JLabel("Marker Shape"));
    shapeLabel = new JLabel();
    interior.add(shapeLabel);
    Integer[] shapeIndex = new Integer[MarkerShape.size];
    for (int i = 0; i < shapeIndex.length; i++) {
        shapeIndex[i] = i;
    }
    shapeCombo = new JComboBox(shapeIndex);
    comboRender = new ImageComboRender();
    comboRender.setShapes(StaticValues.LOCAL_SHAPE_SERIES);
    shapeCombo.setRenderer(comboRender);
    shapeCombo.setMaximumRowCount(7);
    shapeCombo.setActionCommand(MARKER_SHAPE_COMMAND);
    shapeCombo.addActionListener(this);
    interior.add(shapeCombo);

    interior.add(new JLabel("Marker Filled"));
    markerFilled = new JCheckBox();
    markerFilled.setActionCommand(MARKER_FILLED_COMMAND);
    markerFilled.addActionListener(this);
    interior.add(markerFilled);
    interior.add(new JLabel());

    interior.add(new JLabel("Curve Visable"));
    curveVisable = new JCheckBox();
    curveVisable.setActionCommand(CURVE_VISIBLE_COMMAND);
    curveVisable.addActionListener(this);
    interior.add(curveVisable);
    interior.add(new JLabel());

    individual.add(interior, BorderLayout.NORTH);
    curves.add(individual);
    curves.setName("Curves");
    wrap.setName("Curves");
    wrap.add(curves, BorderLayout.NORTH);
    return wrap;
}

From source file:net.itransformers.topologyviewer.dialogs.snmpDiscovery.DiscoveryManagerDialogV2.java

public DiscoveryManagerDialogV2(JFrame frame, File projectDir) {
    this.frame = frame;
    this.projectDir = projectDir;
    setTitle("Discovery Manager");
    setBounds(100, 100, 960, 364);/*  w  w  w  .  ja  va  2s  .c  om*/
    getContentPane().setLayout(new BorderLayout());
    {

        JPanel buttonPane = new JPanel();
        getContentPane().add(buttonPane, BorderLayout.NORTH);
        {
            buttonPane.setLayout(new BorderLayout(0, 0));
            {
                JPanel panel = new JPanel();
                buttonPane.add(panel);
                panel.setLayout(null);
                {
                    depthComboBox = new JComboBox();
                    depthComboBox.setModel(
                            new DefaultComboBoxModel(new Integer[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }));
                    depthComboBox.setBounds(46, 11, 70, 20);
                    panel.add(depthComboBox);
                }

                JLabel lblMode = new JLabel("Depth:");
                lblMode.setBounds(6, 14, 46, 14);
                panel.add(lblMode);

                JLabel lblAddress = new JLabel("Address:");
                lblAddress.setBounds(172, 14, 56, 14);
                panel.add(lblAddress);

                addressTextField = new JTextField();
                addressTextField.setBounds(230, 11, 113, 20);
                panel.add(addressTextField);
                addressTextField.setColumns(10);

                JLabel lblLabel = new JLabel("Label:");
                lblLabel.setBounds(360, 14, 56, 14);
                panel.add(lblLabel);

                labelTextField = new JTextField();
                labelTextField.setBounds(400, 11, 113, 20);
                panel.add(labelTextField);
                labelTextField.setColumns(10);

                autoLabelCheckBox = new JCheckBox("auto-label");
                autoLabelCheckBox.setBounds(520, 11, 113, 20);
                autoLabelCheckBox.setSelected(true);
                panel.add(autoLabelCheckBox);
                postDiscoveryCheckBox = new JCheckBox("Post Discovery");
                postDiscoveryCheckBox.setBounds(620, 11, 153, 20);
                postDiscoveryCheckBox.setSelected(true);
                panel.add(postDiscoveryCheckBox);

            }
        }
        {
            JPanel panel = new JPanel();
            buttonPane.add(panel, BorderLayout.EAST);
            final JButton stopStartButton = new JButton("Start");
            panel.add(stopStartButton);
            stopStartButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    if ("Start".equals(stopStartButton.getText())) {
                        onStartDiscoveryPre(stopStartButton);
                        onStartDiscovery();
                        onStartDiscoveryPost(stopStartButton);
                    } else {
                        onStopDiscoveryPre(stopStartButton);
                        onStopDiscovery();
                        onStopDiscoveryPost(stopStartButton);

                    }
                }
            });
            stopStartButton.setActionCommand("Start");
            getRootPane().setDefaultButton(stopStartButton);
            {
                pauseResumeButton.setEnabled(false);
                panel.add(pauseResumeButton);
                pauseResumeButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        if ("Pause".equals(pauseResumeButton.getText())) {
                            pauseResumeButton.setEnabled(false);
                            onPauseDiscovery();
                            pauseResumeButton.setText("Resume");
                            pauseResumeButton.setEnabled(true);
                        } else {
                            pauseResumeButton.setEnabled(false);
                            onResumeDiscovery();
                            pauseResumeButton.setText("Pause");
                            pauseResumeButton.setEnabled(true);
                        }
                    }
                });
            }
        }
    }
    {
        lblDiscoveredDevices = new JTextArea();
        JScrollPane scrolltxt = new JScrollPane(lblDiscoveredDevices);
        lblDiscoveredDevices.append("Discovery process output");
        getContentPane().add(scrolltxt, BorderLayout.CENTER);
    }
    {
        JPanel statusPanel = new JPanel();
        getContentPane().add(statusPanel, BorderLayout.SOUTH);
        statusPanel.setLayout(new BorderLayout(0, 0));
        {
            JPanel panel = new JPanel();
            statusPanel.add(panel);
            panel.setLayout(new BorderLayout(0, 0));
            //panel.setSize(100:100);
            {
                loggerConsole = new JTextArea();
                JScrollPane scrolltxt = new JScrollPane(loggerConsole);
                loggerConsole.append("Discovery logger console");
                panel.add(scrolltxt, BorderLayout.CENTER);
            }
        }
    }
    {
        Logger logger = Logger.getRootLogger();
        logger.setLevel(Level.INFO);
        logger.addAppender(new AppenderSkeleton() {
            @Override
            protected void append(final LoggingEvent loggingEvent) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        loggerConsole.append(loggingEvent.getMessage().toString());
                        loggerConsole.append("\n");
                    }
                });
            }

            @Override
            public void close() {
            }

            @Override
            public boolean requiresLayout() {
                return false;
            }
        });
    }
}

From source file:analysers.FilterValidatedDialog.java

/**
 * Create the dialog.//from  ww  w  .  j a va  2s.  c  o m
 */
public FilterValidatedDialog() {
    setTitle("Validated Lineages: Export Filter");
    setBounds(100, 100, 632, 348);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 160, 440, 0 };
    gbl_contentPanel.rowHeights = new int[] { 1, 28, 28, 28, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_contentPanel);
    {
        JLabel lblCriterion = new JLabel("Lineage Criterion");
        lblCriterion.setFont(new Font("Lucida Grande", Font.BOLD, 13));
        GridBagConstraints gbc_lblCriterion = new GridBagConstraints();
        gbc_lblCriterion.insets = new Insets(0, 0, 5, 5);
        gbc_lblCriterion.gridx = 0;
        gbc_lblCriterion.gridy = 0;
        contentPanel.add(lblCriterion, gbc_lblCriterion);
    }
    {
        JLabel lblValue = new JLabel("Value");
        lblValue.setFont(new Font("Lucida Grande", Font.BOLD, 13));
        GridBagConstraints gbc_lblValue = new GridBagConstraints();
        gbc_lblValue.insets = new Insets(0, 0, 5, 0);
        gbc_lblValue.gridx = 1;
        gbc_lblValue.gridy = 0;
        contentPanel.add(lblValue, gbc_lblValue);
    }
    {
        lblMinLineageLength = new JLabel("Min. Length (frames)");
        GridBagConstraints gbc_lblMinLineageLength = new GridBagConstraints();
        gbc_lblMinLineageLength.fill = GridBagConstraints.BOTH;
        gbc_lblMinLineageLength.insets = new Insets(0, 0, 5, 5);
        gbc_lblMinLineageLength.gridx = 0;
        gbc_lblMinLineageLength.gridy = 1;
        contentPanel.add(lblMinLineageLength, gbc_lblMinLineageLength);
    }
    {
        minLinLen = new JTextField();
        GridBagConstraints gbc_minLinLen = new GridBagConstraints();
        gbc_minLinLen.anchor = GridBagConstraints.NORTH;
        gbc_minLinLen.fill = GridBagConstraints.HORIZONTAL;
        gbc_minLinLen.insets = new Insets(0, 0, 5, 0);
        gbc_minLinLen.gridx = 1;
        gbc_minLinLen.gridy = 1;
        contentPanel.add(minLinLen, gbc_minLinLen);
        minLinLen.setText("1");
        minLinLen.setColumns(3);
    }
    {
        lblStartFrameOf = new JLabel("Max. Start Frame");
        GridBagConstraints gbc_lblStartFrameOf = new GridBagConstraints();
        gbc_lblStartFrameOf.fill = GridBagConstraints.HORIZONTAL;
        gbc_lblStartFrameOf.insets = new Insets(0, 0, 5, 5);
        gbc_lblStartFrameOf.gridx = 0;
        gbc_lblStartFrameOf.gridy = 2;
        contentPanel.add(lblStartFrameOf, gbc_lblStartFrameOf);
    }
    {
        startLin = new JTextField();
        GridBagConstraints gbc_startLin = new GridBagConstraints();
        gbc_startLin.insets = new Insets(0, 0, 5, 0);
        gbc_startLin.fill = GridBagConstraints.HORIZONTAL;
        gbc_startLin.gridx = 1;
        gbc_startLin.gridy = 2;
        contentPanel.add(startLin, gbc_startLin);
        startLin.setText("-1");
        startLin.setColumns(3);
    }
    {
        JButton btnPreview = new JButton("Preview");
        btnPreview.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                preview.setText(makePreview());
            }
        });
        GridBagConstraints gbc_btnPreview = new GridBagConstraints();
        gbc_btnPreview.insets = new Insets(0, 0, 5, 5);
        gbc_btnPreview.gridx = 0;
        gbc_btnPreview.gridy = 3;
        contentPanel.add(btnPreview, gbc_btnPreview);
    }
    {
        JScrollPane scrollPane = new JScrollPane();
        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
        gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
        gbc_scrollPane.fill = GridBagConstraints.BOTH;
        gbc_scrollPane.gridx = 1;
        gbc_scrollPane.gridy = 3;
        contentPanel.add(scrollPane, gbc_scrollPane);
        {
            preview = new JTextArea();
            scrollPane.setViewportView(preview);
            preview.setEditable(false);
            preview.setColumns(10);
            preview.setTabSize(4);
        }
    }
    {
        JLabel lblOptions = new JLabel("Options");
        GridBagConstraints gbc_lblOptions = new GridBagConstraints();
        gbc_lblOptions.insets = new Insets(0, 0, 0, 5);
        gbc_lblOptions.gridx = 0;
        gbc_lblOptions.gridy = 4;
        contentPanel.add(lblOptions, gbc_lblOptions);
    }
    {
        JPanel panel = new JPanel();
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.anchor = GridBagConstraints.NORTH;
        gbc_panel.fill = GridBagConstraints.HORIZONTAL;
        gbc_panel.gridx = 1;
        gbc_panel.gridy = 4;
        contentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 69, 169, 162, 0 };
        gbl_panel.rowHeights = new int[] { 23, 23, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            rdbtnExportMeanIntensity = new JRadioButton("Export Mean Intensity");
            rdbtnExportMeanIntensity.setSelected(true);
            buttonGroup.add(rdbtnExportMeanIntensity);
            GridBagConstraints gbc_rdbtnExportMeanIntensity = new GridBagConstraints();
            gbc_rdbtnExportMeanIntensity.anchor = GridBagConstraints.NORTHWEST;
            gbc_rdbtnExportMeanIntensity.insets = new Insets(0, 0, 5, 5);
            gbc_rdbtnExportMeanIntensity.gridx = 1;
            gbc_rdbtnExportMeanIntensity.gridy = 0;
            panel.add(rdbtnExportMeanIntensity, gbc_rdbtnExportMeanIntensity);
        }
        {
            rdbtnExportMaxIntensity = new JRadioButton("Export Max Intensity");
            buttonGroup.add(rdbtnExportMaxIntensity);
            GridBagConstraints gbc_rdbtnExportMaxIntensity = new GridBagConstraints();
            gbc_rdbtnExportMaxIntensity.anchor = GridBagConstraints.NORTHWEST;
            gbc_rdbtnExportMaxIntensity.insets = new Insets(0, 0, 5, 0);
            gbc_rdbtnExportMaxIntensity.gridx = 2;
            gbc_rdbtnExportMaxIntensity.gridy = 0;
            panel.add(rdbtnExportMaxIntensity, gbc_rdbtnExportMaxIntensity);
        }
        {
            chckbxExportPositions = new JCheckBox("Export Cell Positions and Areas in CSV");
            GridBagConstraints gbc_chckbxExportPositions = new GridBagConstraints();
            gbc_chckbxExportPositions.anchor = GridBagConstraints.NORTH;
            gbc_chckbxExportPositions.gridwidth = 2;
            gbc_chckbxExportPositions.gridx = 1;
            gbc_chckbxExportPositions.gridy = 1;
            panel.add(chckbxExportPositions, gbc_chckbxExportPositions);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    if (validateFields()) {
                        Prefs.set("TrackApp.FilterValidatedDialog.startLin", valStartLin);
                        Prefs.set("TrackApp.FilterValidatedDialog.minLinLen", valMinLinLen);
                        Prefs.set("TrackApp.FilterValidatedDialog.exportMean", doExportMean);
                        Prefs.set("TrackApp.FilterValidatedDialog.exportPositions", doExportPositions);
                        Prefs.savePreferences();
                        dispose();
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    dispose();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}

From source file:ffx.ui.KeywordPanel.java

/**
 * <p>/*from   ww w  .  j a  v  a  2 s  .c  o m*/
 * initToolBar</p>
 */
public void initToolBar() {
    toolBar = new JToolBar("Keyword Editor");
    toolBar.setLayout(flowLayout);
    ClassLoader loader = getClass().getClassLoader();
    JButton jbopen = new JButton(new ImageIcon(loader.getResource("ffx/ui/icons/folder_page.png")));
    jbopen.setActionCommand("Open...");
    jbopen.setToolTipText("Open a *.KEY File for Editing");
    jbopen.addActionListener(this);
    Insets insets = jbopen.getInsets();
    insets.top = 2;
    insets.bottom = 2;
    insets.left = 2;
    insets.right = 2;
    jbopen.setMargin(insets);
    //toolBar.add(jbopen);
    JButton jbsave = new JButton(new ImageIcon(loader.getResource("ffx/ui/icons/disk.png")));
    jbsave.setActionCommand("Save");
    jbsave.setToolTipText("Save the Active *.KEY File");
    jbsave.addActionListener(this);
    jbsave.setMargin(insets);
    toolBar.add(jbsave);
    JButton jbsaveas = new JButton(new ImageIcon(loader.getResource("ffx/ui/icons/page_save.png")));
    jbsaveas.setActionCommand("Save As...");
    jbsaveas.setToolTipText("Save the Active *.KEY File Under a New Name");
    jbsaveas.addActionListener(this);
    jbsaveas.setMargin(insets);
    toolBar.add(jbsaveas);
    JButton jbclose = new JButton(new ImageIcon(loader.getResource("ffx/ui/icons/cancel.png")));
    jbclose.setActionCommand("Close");
    jbclose.setToolTipText("Close the Active *.KEY File");
    jbclose.addActionListener(this);
    jbclose.setMargin(insets);
    //toolBar.add(jbclose);
    toolBar.addSeparator();
    groupComboBox.setMaximumSize(groupComboBox.getPreferredSize());
    groupComboBox.addActionListener(this);
    groupComboBox.setEditable(false);
    toolBar.add(groupComboBox);
    toolBar.addSeparator();
    ImageIcon icinfo = new ImageIcon(loader.getResource("ffx/ui/icons/information.png"));
    descriptCheckBox = new JCheckBoxMenuItem(icinfo);
    descriptCheckBox.setActionCommand("Description");
    descriptCheckBox.setToolTipText("Show/Hide Keyword Descriptions");
    descriptCheckBox.addActionListener(this);
    descriptCheckBox.setMargin(insets);
    toolBar.add(descriptCheckBox);
    toolBar.add(new JLabel(""));
    toolBar.setBorderPainted(false);
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    toolBar.setOrientation(JToolBar.HORIZONTAL);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

From source file:cl.uai.webcursos.emarking.desktop.OptionsDialog.java

/**
 * Create the dialog.//w w w.j a v a 2s . c  o  m
 */
public OptionsDialog(Moodle _moodle) {
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            cancelled = true;
        }
    });
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setIconImage(Toolkit.getDefaultToolkit().getImage(OptionsDialog.class
            .getResource("/cl/uai/webcursos/emarking/desktop/resources/glyphicons_439_wrench.png")));
    setTitle(EmarkingDesktop.lang.getString("emarkingoptions"));
    setModal(true);
    setBounds(100, 100, 707, 444);
    this.moodle = _moodle;
    this.moodle.loadProperties();
    getContentPane().setLayout(new BorderLayout());
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            okButton = new JButton(EmarkingDesktop.lang.getString("ok"));
            okButton.setEnabled(false);
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
                        if (!validator.isValid(moodleurl.getText())) {
                            throw new Exception(EmarkingDesktop.lang.getString("invalidmoodleurl") + " "
                                    + moodleurl.getText());
                        }
                        File f = new File(filename.getText());
                        if (!f.exists() || f.isDirectory()
                                || (!f.getPath().endsWith(".pdf") && !f.getPath().endsWith(".zip"))) {
                            throw new Exception(EmarkingDesktop.lang.getString("invalidpdffile") + " "
                                    + filename.getText());
                        }
                        if (omrtemplate.getText().trim().length() > 0) {
                            File omrf = new File(omrtemplate.getText());
                            if (!omrf.exists() || omrf.isDirectory() || (!omrf.getPath().endsWith(".xtmpl"))) {
                                throw new Exception(EmarkingDesktop.lang.getString("invalidomrfile") + " "
                                        + omrtemplate.getText());
                            }
                        }
                        moodle.setLastfile(filename.getText());
                        moodle.getQrExtractor().setDoubleside(chckbxDoubleSide.isSelected());
                        moodle.setMaxthreads(Integer.parseInt(getMaxThreads().getSelectedItem().toString()));
                        moodle.setResolution(Integer.parseInt(getResolution().getSelectedItem().toString()));
                        moodle.setMaxzipsize(getMaxZipSize().getSelectedItem().toString());
                        moodle.setOMRTemplate(omrtemplate.getText());
                        moodle.setThreshold(Integer.parseInt(spinnerOMRthreshold.getValue().toString()));
                        moodle.setDensity(Integer.parseInt(spinnerOMRdensity.getValue().toString()));
                        moodle.setShapeSize(Integer.parseInt(spinnerOMRshapeSize.getValue().toString()));
                        moodle.setAnonymousPercentage(
                                Integer.parseInt(spinnerAnonymousPercentage.getValue().toString()));
                        moodle.setAnonymousPercentageCustomPage(
                                Integer.parseInt(spinnerAnonymousPercentageCustomPage.getValue().toString()));
                        moodle.setFakeStudents(chckbxMarkersTraining.isSelected());
                        moodle.saveProperties();
                        cancelled = false;
                        setVisible(false);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        JOptionPane.showMessageDialog(panel,
                                EmarkingDesktop.lang.getString("invaliddatainform"));
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton(EmarkingDesktop.lang.getString("cancel"));
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    cancelled = true;
                    setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }

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

    panel = new JPanel();
    tabbedPane.addTab(EmarkingDesktop.lang.getString("general"), null, panel, null);
    panel.setLayout(null);

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_2.setBounds(10, 11, 665, 131);
    panel.add(panel_2);
    panel_2.setLayout(null);

    JLabel lblPassword = new JLabel(EmarkingDesktop.lang.getString("password"));
    lblPassword.setBounds(10, 99, 109, 14);
    panel_2.add(lblPassword);
    lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);

    password = new JPasswordField();
    password.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testConnection();
        }
    });
    password.setBounds(129, 96, 329, 20);
    panel_2.add(password);
    this.password.setText(this.moodle.getPassword());

    btnTestConnection = new JButton(EmarkingDesktop.lang.getString("connect"));
    btnTestConnection.setEnabled(false);
    btnTestConnection.setBounds(468, 93, 172, 27);
    panel_2.add(btnTestConnection);

    username = new JTextField();
    username.setBounds(129, 65, 329, 20);
    panel_2.add(username);
    username.setColumns(10);
    this.username.setText(this.moodle.getUsername());

    moodleurl = new JTextField();
    moodleurl.setBounds(129, 34, 329, 20);
    panel_2.add(moodleurl);
    moodleurl.setColumns(10);
    moodleurl.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            warn();
        }

        private void warn() {
            UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
            if (!validator.isValid(moodleurl.getText()) || !moodleurl.getText().endsWith("/")) {
                moodleurl.setForeground(Color.RED);
                btnTestConnection.setEnabled(false);
            } else {
                moodleurl.setForeground(Color.BLACK);
                btnTestConnection.setEnabled(true);
            }
        }
    });

    // Initializing values from moodle configuration
    this.moodleurl.setText(this.moodle.getUrl());

    JLabel lblMoodleUrl = new JLabel(EmarkingDesktop.lang.getString("moodleurl"));
    lblMoodleUrl.setBounds(10, 37, 109, 14);
    panel_2.add(lblMoodleUrl);
    lblMoodleUrl.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblUsername = new JLabel(EmarkingDesktop.lang.getString("username"));
    lblUsername.setBounds(10, 68, 109, 14);
    panel_2.add(lblUsername);
    lblUsername.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblMoodleSettings = new JLabel(EmarkingDesktop.lang.getString("moodlesettings"));
    lblMoodleSettings.setBounds(10, 11, 230, 14);
    panel_2.add(lblMoodleSettings);
    btnTestConnection.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testConnection();
        }
    });

    JPanel panel_3 = new JPanel();
    panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_3.setBounds(10, 159, 666, 174);
    panel.add(panel_3);
    panel_3.setLayout(null);

    JLabel lblPdfFile = new JLabel(EmarkingDesktop.lang.getString("pdffile"));
    lblPdfFile.setBounds(0, 39, 119, 14);
    panel_3.add(lblPdfFile);
    lblPdfFile.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblScanned = new JLabel(EmarkingDesktop.lang.getString("scanned"));
    lblScanned.setBounds(0, 64, 119, 14);
    panel_3.add(lblScanned);
    lblScanned.setHorizontalAlignment(SwingConstants.RIGHT);

    chckbxDoubleSide = new JCheckBox(EmarkingDesktop.lang.getString("doubleside"));
    chckbxDoubleSide.setEnabled(false);
    chckbxDoubleSide.setBounds(125, 60, 333, 23);
    panel_3.add(chckbxDoubleSide);
    chckbxDoubleSide.setToolTipText(EmarkingDesktop.lang.getString("doublesidetooltip"));
    this.chckbxDoubleSide.setSelected(this.moodle.getQrExtractor().isDoubleside());

    filename = new JTextField();
    filename.setEnabled(false);
    filename.setBounds(129, 36, 329, 20);
    panel_3.add(filename);
    filename.setColumns(10);
    filename.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            warn();
        }

        private void warn() {
            validateFileForProcessing(!btnTestConnection.isEnabled());
        }
    });
    this.filename.setText(this.moodle.getLastfile());

    btnOpenPdfFile = new JButton(EmarkingDesktop.lang.getString("openfile"));
    btnOpenPdfFile.setEnabled(false);
    btnOpenPdfFile.setBounds(468, 33, 172, 27);
    panel_3.add(btnOpenPdfFile);

    JLabel lblPdfFileSettings = new JLabel(EmarkingDesktop.lang.getString("filesettings"));
    lblPdfFileSettings.setBounds(10, 11, 230, 14);
    panel_3.add(lblPdfFileSettings);

    JLabel lblOMRtemplate = new JLabel(EmarkingDesktop.lang.getString("omrfile"));
    lblOMRtemplate.setHorizontalAlignment(SwingConstants.RIGHT);
    lblOMRtemplate.setBounds(0, 142, 119, 14);
    panel_3.add(lblOMRtemplate);

    omrtemplate = new JTextField();
    omrtemplate.setEnabled(false);
    omrtemplate.setText((String) null);
    omrtemplate.setColumns(10);
    omrtemplate.setBounds(129, 139, 329, 20);
    panel_3.add(omrtemplate);
    omrtemplate.setText(this.moodle.getOMRTemplate());

    btnOpenOMRTemplate = new JButton(EmarkingDesktop.lang.getString("openomrfile"));
    btnOpenOMRTemplate.setEnabled(false);
    btnOpenOMRTemplate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser chooser = new JFileChooser();
            chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle"));
            chooser.setDialogType(JFileChooser.OPEN_DIALOG);
            chooser.setFileFilter(new FileFilter() {
                @Override
                public String getDescription() {
                    return "*.xtmpl";
                }

                @Override
                public boolean accept(File arg0) {
                    if (arg0.getName().endsWith(".xtmpl") || arg0.isDirectory())
                        return true;
                    return false;
                }
            });
            int retval = chooser.showOpenDialog(panel);
            if (retval == JFileChooser.APPROVE_OPTION) {
                omrtemplate.setText(chooser.getSelectedFile().getAbsolutePath());
            } else {
                return;
            }
        }
    });
    btnOpenOMRTemplate.setBounds(468, 136, 172, 27);
    panel_3.add(btnOpenOMRTemplate);

    lblMarkersTraining = new JLabel((String) EmarkingDesktop.lang.getString("markerstraining"));
    lblMarkersTraining.setHorizontalAlignment(SwingConstants.RIGHT);
    lblMarkersTraining.setBounds(0, 89, 119, 14);
    panel_3.add(lblMarkersTraining);

    chckbxMarkersTraining = new JCheckBox(EmarkingDesktop.lang.getString("markerstrainingfakestudents"));
    chckbxMarkersTraining.setBounds(125, 87, 333, 23);
    panel_3.add(chckbxMarkersTraining);
    btnOpenPdfFile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okButton.setEnabled(false);
            JFileChooser chooser = new JFileChooser();
            chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle"));
            chooser.setDialogType(JFileChooser.OPEN_DIALOG);
            chooser.setFileFilter(new FileFilter() {
                @Override
                public String getDescription() {
                    return "*.pdf, *.zip";
                }

                @Override
                public boolean accept(File arg0) {
                    if (arg0.getName().endsWith(".zip") || arg0.getName().endsWith(".pdf")
                            || arg0.isDirectory())
                        return true;
                    return false;
                }
            });
            int retval = chooser.showOpenDialog(panel);
            if (retval == JFileChooser.APPROVE_OPTION) {
                filename.setText(chooser.getSelectedFile().getAbsolutePath());
                okButton.setEnabled(true);
            } else {
                return;
            }
        }
    });

    JPanel panel_1 = new JPanel();
    tabbedPane.addTab(EmarkingDesktop.lang.getString("advanced"), null, panel_1, null);
    panel_1.setLayout(null);

    JPanel panel_4 = new JPanel();
    panel_4.setLayout(null);
    panel_4.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_4.setBounds(10, 11, 665, 131);
    panel_1.add(panel_4);

    JLabel lblAdvancedOptions = new JLabel(EmarkingDesktop.lang.getString("advancedoptions"));
    lblAdvancedOptions.setBounds(10, 11, 233, 14);
    panel_4.add(lblAdvancedOptions);

    JLabel lblThreads = new JLabel(EmarkingDesktop.lang.getString("maxthreads"));
    lblThreads.setBounds(10, 38, 130, 14);
    panel_4.add(lblThreads);
    lblThreads.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblSomething = new JLabel(EmarkingDesktop.lang.getString("separatezipfiles"));
    lblSomething.setBounds(10, 73, 130, 14);
    panel_4.add(lblSomething);
    lblSomething.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel label = new JLabel(EmarkingDesktop.lang.getString("resolution"));
    label.setBounds(10, 105, 130, 14);
    panel_4.add(label);
    label.setHorizontalAlignment(SwingConstants.RIGHT);

    resolution = new JComboBox<Integer>();
    resolution.setBounds(150, 99, 169, 27);
    panel_4.add(resolution);
    resolution.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 75, 100, 150, 300, 400, 500, 600 }));
    resolution.setSelectedIndex(2);
    this.resolution.setSelectedItem(this.moodle.getQrExtractor().getResolution());

    maxZipSize = new JComboBox<String>();
    maxZipSize.setBounds(150, 67, 169, 27);
    panel_4.add(maxZipSize);
    maxZipSize.setModel(new DefaultComboBoxModel<String>(new String[] { "<dynamic>", "2Mb", "4Mb", "8Mb",
            "16Mb", "32Mb", "64Mb", "128Mb", "256Mb", "512Mb", "1024Mb" }));
    maxZipSize.setSelectedIndex(6);
    this.maxZipSize.setSelectedItem(this.moodle.getMaxZipSizeString());

    maxThreads = new JComboBox<Integer>();
    maxThreads.setBounds(150, 32, 169, 27);
    panel_4.add(maxThreads);
    maxThreads.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 2, 4, 8, 16 }));
    maxThreads.setSelectedIndex(1);
    this.maxThreads.setSelectedItem(this.moodle.getQrExtractor().getMaxThreads());

    JPanel panel_5 = new JPanel();
    panel_5.setLayout(null);
    panel_5.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_5.setBounds(10, 153, 665, 131);
    panel_1.add(panel_5);

    JLabel lblOMRoptions = new JLabel(EmarkingDesktop.lang.getString("omroptions"));
    lblOMRoptions.setBounds(10, 11, 233, 14);
    panel_5.add(lblOMRoptions);

    JLabel lblOMRthreshold = new JLabel(EmarkingDesktop.lang.getString("omrthreshold"));
    lblOMRthreshold.setHorizontalAlignment(SwingConstants.RIGHT);
    lblOMRthreshold.setBounds(10, 32, 130, 14);
    panel_5.add(lblOMRthreshold);

    JLabel lblShapeSize = new JLabel(EmarkingDesktop.lang.getString("omrshapesize"));
    lblShapeSize.setHorizontalAlignment(SwingConstants.RIGHT);
    lblShapeSize.setBounds(10, 99, 130, 14);
    panel_5.add(lblShapeSize);

    JLabel lblDensity = new JLabel(EmarkingDesktop.lang.getString("omrdensity"));
    lblDensity.setHorizontalAlignment(SwingConstants.RIGHT);
    lblDensity.setBounds(10, 70, 130, 14);
    panel_5.add(lblDensity);

    spinnerOMRthreshold = new JSpinner();
    spinnerOMRthreshold.setBounds(150, 32, 169, 20);
    panel_5.add(spinnerOMRthreshold);
    spinnerOMRthreshold.setValue(this.moodle.getOMRthreshold());

    spinnerOMRdensity = new JSpinner();
    spinnerOMRdensity.setBounds(150, 67, 169, 20);
    panel_5.add(spinnerOMRdensity);
    spinnerOMRdensity.setValue(this.moodle.getOMRdensity());

    spinnerOMRshapeSize = new JSpinner();
    spinnerOMRshapeSize.setBounds(150, 99, 169, 20);
    panel_5.add(spinnerOMRshapeSize);
    spinnerOMRshapeSize.setValue(this.moodle.getOMRshapeSize());

    JLabel lblAnonymousPercentage = new JLabel(
            "<html>" + EmarkingDesktop.lang.getString("anonymouspercentage") + "</html>");
    lblAnonymousPercentage.setHorizontalAlignment(SwingConstants.RIGHT);
    lblAnonymousPercentage.setBounds(329, 32, 130, 27);
    panel_5.add(lblAnonymousPercentage);

    spinnerAnonymousPercentage = new JSpinner();
    spinnerAnonymousPercentage.setBounds(469, 32, 169, 20);
    panel_5.add(spinnerAnonymousPercentage);
    spinnerAnonymousPercentage.setValue(this.moodle.getAnonymousPercentage());

    JLabel lblAnonymousPercentageCustomPage = new JLabel(
            "<html>" + EmarkingDesktop.lang.getString("anonymouspercentagecustompage") + "</html>");
    lblAnonymousPercentageCustomPage.setHorizontalAlignment(SwingConstants.RIGHT);
    lblAnonymousPercentageCustomPage.setBounds(329, 70, 130, 27);
    panel_5.add(lblAnonymousPercentageCustomPage);

    spinnerAnonymousPercentageCustomPage = new JSpinner();
    spinnerAnonymousPercentageCustomPage.setBounds(469, 70, 169, 20);
    panel_5.add(spinnerAnonymousPercentageCustomPage);
    spinnerAnonymousPercentageCustomPage.setValue(this.moodle.getAnonymousPercentageCustomPage());

    JLabel lblCustomPage = new JLabel(
            "<html>" + EmarkingDesktop.lang.getString("anonymouscustompage") + "</html>");
    lblCustomPage.setHorizontalAlignment(SwingConstants.RIGHT);
    lblCustomPage.setBounds(329, 99, 130, 27);
    panel_5.add(lblCustomPage);

    spinnerCustomPage = new JSpinner();
    spinnerCustomPage.setBounds(469, 99, 169, 20);
    panel_5.add(spinnerCustomPage);
    spinnerCustomPage.setValue(this.moodle.getAnonymousCustomPage());
}

From source file:com.vgi.mafscaling.LogView.java

private void createChartTab() {
    JPanel plotPanel = new JPanel();
    add(plotPanel, "<html><div style='text-align: center;'>3<br>D<br><br>C<br>h<br>a<br>r<br>t</div></html>");
    GridBagLayout gbl_plotPanel = new GridBagLayout();
    gbl_plotPanel.columnWidths = new int[] { 0 };
    gbl_plotPanel.rowHeights = new int[] { 0, 0 };
    gbl_plotPanel.columnWeights = new double[] { 1.0 };
    gbl_plotPanel.rowWeights = new double[] { 0.0, 1.0 };
    plotPanel.setLayout(gbl_plotPanel);//from w ww  .j a v a2 s .  c om

    JPanel cntlPanel = new JPanel();
    GridBagConstraints gbc_ctrlPanel = new GridBagConstraints();
    gbc_ctrlPanel.insets = insets3;
    gbc_ctrlPanel.anchor = GridBagConstraints.NORTH;
    gbc_ctrlPanel.weightx = 1.0;
    gbc_ctrlPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_ctrlPanel.gridx = 0;
    gbc_ctrlPanel.gridy = 0;
    plotPanel.add(cntlPanel, gbc_ctrlPanel);

    GridBagLayout gbl_cntlPanel = new GridBagLayout();
    gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_cntlPanel.rowHeights = new int[] { 0 };
    gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 };
    gbl_cntlPanel.rowWeights = new double[] { 0 };
    cntlPanel.setLayout(gbl_cntlPanel);

    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.anchor = GridBagConstraints.EAST;
    gbc_label.insets = new Insets(3, 3, 3, 0);
    gbc_label.gridx = 0;
    gbc_label.gridy = 0;

    GridBagConstraints gbc_column = new GridBagConstraints();
    gbc_column.anchor = GridBagConstraints.WEST;
    gbc_column.insets = insets3;
    gbc_column.gridx = 1;
    gbc_column.gridy = 0;

    cntlPanel.add(new JLabel("X-Axis"), gbc_label);

    xAxisColumn = new JComboBox<String>();
    xAxisColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
    cntlPanel.add(xAxisColumn, gbc_column);

    gbc_label.gridx += 2;
    cntlPanel.add(new JLabel("Y-Axis"), gbc_label);

    gbc_column.gridx += 2;
    yAxisColumn = new JComboBox<String>();
    yAxisColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
    cntlPanel.add(yAxisColumn, gbc_column);

    gbc_label.gridx += 2;
    cntlPanel.add(new JLabel("Plots"), gbc_label);

    gbc_column.gridx += 2;
    plotsColumn = new JMultiSelectionBox();
    plotsColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
    cntlPanel.add(plotsColumn, gbc_column);

    gbc_label.gridx = 7;
    JButton btnGoButton = new JButton("View");
    btnGoButton.setActionCommand("view");
    btnGoButton.addActionListener(this);
    cntlPanel.add(btnGoButton, gbc_label);

    plot3d = new Plot3DPanel("SOUTH") {
        private static final long serialVersionUID = 7914951068593204419L;

        public void addPlotToolBar(String location) {
            super.addPlotToolBar(location);
            super.plotToolBar.remove(7);
            super.plotToolBar.remove(5);
            super.plotToolBar.remove(4);
        }
    };
    plot3d.setAutoBounds();
    plot3d.setAutoscrolls(true);
    plot3d.setEditable(false);
    plot3d.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    plot3d.setForeground(Color.BLACK);
    plot3d.getAxis(0).setColor(Color.BLACK);
    plot3d.getAxis(1).setColor(Color.BLACK);
    plot3d.getAxis(2).setColor(Color.BLACK);

    GridBagConstraints gbc_chartPanel = new GridBagConstraints();
    gbc_chartPanel.anchor = GridBagConstraints.CENTER;
    gbc_chartPanel.insets = insets3;
    gbc_chartPanel.weightx = 1.0;
    gbc_chartPanel.weighty = 1.0;
    gbc_chartPanel.fill = GridBagConstraints.BOTH;
    gbc_chartPanel.gridx = 0;
    gbc_chartPanel.gridy = 1;
    plotPanel.add(plot3d, gbc_chartPanel);
}

From source file:ca.uhn.hl7v2.testpanel.ui.AddMessageDialog.java

/**
 * Create the dialog./*ww  w . j  av  a 2s .co  m*/
 */
public AddMessageDialog(Controller theController) {
    myController = theController;

    setMinimumSize(new Dimension(450, 400));
    setPreferredSize(new Dimension(450, 400));
    setSize(new Dimension(450, 400));
    setResizable(false);
    setMaximumSize(new Dimension(450, 400));
    setTitle("Add Message");
    setBounds(100, 100, 450, 401);
    getContentPane().setLayout(new BorderLayout());
    mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(mycontentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 0, 0 };
    gbl_contentPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    mycontentPanel.setLayout(gbl_contentPanel);
    {
        JPanel panel = new JPanel();
        panel.setBorder(
                new TitledBorder(null, "Message Type", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.weighty = 1.0;
        gbc_panel.insets = new Insets(0, 0, 5, 0);
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 0;
        mycontentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0, 0 };
        gbl_panel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            JLabel lblVersion = new JLabel("Version");
            GridBagConstraints gbc_lblVersion = new GridBagConstraints();
            gbc_lblVersion.insets = new Insets(0, 0, 5, 5);
            gbc_lblVersion.gridx = 0;
            gbc_lblVersion.gridy = 0;
            panel.add(lblVersion, gbc_lblVersion);
        }
        {
            JLabel lblType = new JLabel("Type");
            GridBagConstraints gbc_lblType = new GridBagConstraints();
            gbc_lblType.insets = new Insets(0, 0, 5, 0);
            gbc_lblType.gridx = 1;
            gbc_lblType.gridy = 0;
            panel.add(lblType, gbc_lblType);
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportBorder(null);
            GridBagConstraints gbc_scrollPane = new GridBagConstraints();
            gbc_scrollPane.weighty = 1.0;
            gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
            gbc_scrollPane.fill = GridBagConstraints.BOTH;
            gbc_scrollPane.gridx = 0;
            gbc_scrollPane.gridy = 1;
            panel.add(scrollPane, gbc_scrollPane);
            {
                myVersionList = new JList();
                myVersionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane.setViewportView(myVersionList);
            }
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportBorder(null);
            GridBagConstraints gbc_scrollPane = new GridBagConstraints();
            gbc_scrollPane.weighty = 1.0;
            gbc_scrollPane.weightx = 1.0;
            gbc_scrollPane.fill = GridBagConstraints.BOTH;
            gbc_scrollPane.gridx = 1;
            gbc_scrollPane.gridy = 1;
            panel.add(scrollPane, gbc_scrollPane);
            {
                myMessageTypeList = new JList();
                myMessageTypeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane.setViewportView(myMessageTypeList);
            }
        }
    }
    {
        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(null, "Options", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 1;
        mycontentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            JLabel lblEncoding = new JLabel("Encoding");
            GridBagConstraints gbc_lblEncoding = new GridBagConstraints();
            gbc_lblEncoding.insets = new Insets(0, 0, 0, 5);
            gbc_lblEncoding.gridx = 0;
            gbc_lblEncoding.gridy = 0;
            panel.add(lblEncoding, gbc_lblEncoding);
        }
        {
            JPanel panel_1 = new JPanel();
            panel_1.setBorder(null);
            GridBagConstraints gbc_panel_1 = new GridBagConstraints();
            gbc_panel_1.anchor = GridBagConstraints.WEST;
            gbc_panel_1.fill = GridBagConstraints.VERTICAL;
            gbc_panel_1.gridx = 1;
            gbc_panel_1.gridy = 0;
            panel.add(panel_1, gbc_panel_1);
            {
                myEr7Radio = new JRadioButton("ER7");
                myEr7Radio.setSelected(true);
                encodingButtonGroup.add(myEr7Radio);
                panel_1.add(myEr7Radio);
            }
            {
                JRadioButton myXmlRadio = new JRadioButton("XML");
                encodingButtonGroup.add(myXmlRadio);
                panel_1.add(myXmlRadio);
            }
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        String version = (String) myVersionList.getSelectedValue();
                        String fullType = (String) myMessageTypeList.getSelectedValue();
                        String structure = myTypesToStructures.get(fullType);
                        String[] fullTypeBits = fullType.split("\\^");
                        String type = fullTypeBits[0];
                        String trigger = fullTypeBits[1];

                        Hl7V2EncodingTypeEnum encoding = myEr7Radio.isSelected() ? Hl7V2EncodingTypeEnum.ER_7
                                : Hl7V2EncodingTypeEnum.XML;
                        myController.addMessage(version, type, trigger, structure, encoding);
                    } finally {
                        setVisible(false);
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    AddMessageDialog.this.setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }

    initLocal();
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Initialize GUI components.// w w w.j a v  a  2s .co  m
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initGUI() {

    App.init();

    // setBounds(100, 100, 972, 439);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setIconImage(Builder.getApplicationIcon());
    setTitle("Sample Size Analysis");
    getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    getContentPane().add(toolBar, "cell 0 0,growx,aligny top");

    JToolBarButton btnOpen = new JToolBarButton(actionBrowse);
    btnOpen.setIcon(Builder.getImageIcon("fileopen.png"));
    toolBar.add(btnOpen);

    JToolBarButton btnSave = new JToolBarButton(actionSaveTable);
    btnSave.setIcon(Builder.getImageIcon("save.png"));
    toolBar.add(btnSave);

    JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF);
    btnExportPDF.setIcon(Builder.getImageIcon("pdf.png"));
    toolBar.add(btnExportPDF);

    JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG);
    btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png"));
    toolBar.add(btnExportPNG);

    toolBar.addSeparator();

    JToolBarButton btnRun = new JToolBarButton(actionRun);
    btnRun.setIcon(Builder.getImageIcon("run.png"));
    toolBar.add(btnRun);

    JPanel panelMain = new JPanel();
    getContentPane().add(panelMain, "cell 0 1,grow");
    panelMain.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPaneMain = new JSplitPane();
    splitPaneMain.setOneTouchExpandable(true);
    panelMain.add(splitPaneMain);

    JPanel panelParameters = new JPanel();
    splitPaneMain.setLeftComponent(panelParameters);
    panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]"));

    JPanel panelInput = new JPanel();
    panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelInput, "cell 0 0,grow");
    panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]"));

    JLabel lblInputFile = new JLabel("Input file:");
    panelInput.add(lblInputFile, "cell 0 0");

    txtInputFile = new JTextField();
    panelInput.add(txtInputFile, "cell 1 0,growx");
    txtInputFile.setActionCommand("NewFileTyped");
    txtInputFile.addActionListener(this);
    txtInputFile.setColumns(10);

    JButton btnBrowse = new JButton("");
    panelInput.add(btnBrowse, "cell 2 0");
    btnBrowse.setAction(actionBrowse);
    btnBrowse.setText("");
    btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png"));
    btnBrowse.setPreferredSize(new Dimension(25, 25));
    btnBrowse.setMaximumSize(new Dimension(25, 25));
    btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured");
    btnBrowse.putClientProperty("JButton.segmentPosition", "middle");

    JPanel panelAnalysisOptions = new JPanel();
    panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelAnalysisOptions, "cell 0 1,grow");
    panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]"));

    JLabel lblEventTypes = new JLabel("Event type:");
    panelAnalysisOptions.add(lblEventTypes, "cell 0 0");

    cboEventType = new JComboBox();
    panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1");
    cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values()));
    new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT);

    chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common");
    chkCommonYears.setEnabled(false);
    new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false);
    panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1");

    chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events");
    chkExcludeSeriesWithNoEvents.setEnabled(false);
    new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false);
    panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1");

    JLabel lblThresholdType = new JLabel("Threshold:");
    panelAnalysisOptions.add(lblThresholdType, "cell 0 3");

    cboThresholdType = new JComboBox();
    panelAnalysisOptions.add(cboThresholdType, "cell 1 3");
    cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values()));
    new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES,
            FireFilterType.NUMBER_OF_EVENTS);

    JLabel label = new JLabel(">=");
    panelAnalysisOptions.add(label, "flowx,cell 2 3");

    spnThresholdValueGT = new JSpinner();
    panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3");
    spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1);

    chkEnableLessThan = new JCheckBox("");
    chkEnableLessThan.setActionCommand("LessThanThresholdStatus");
    chkEnableLessThan.addActionListener(this);
    panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right");

    lblLessThan = new JLabel("<=");
    lblLessThan.setEnabled(false);
    panelAnalysisOptions.add(lblLessThan, "cell 2 4");

    spnThresholdValueLT = new JSpinner();
    spnThresholdValueLT.setEnabled(false);
    spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4");

    lblAnd = new JLabel("and");
    panelAnalysisOptions.add(lblAnd, "cell 1 4");

    JPanel panelSimulations = new JPanel();
    panelSimulations.setBorder(
            new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelSimulations, "cell 0 2,grow");
    panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]"));

    JLabel lblSimulations = new JLabel("Simulations:");
    panelSimulations.add(lblSimulations, "cell 0 0");

    spnSimulations = new JSpinner();
    panelSimulations.add(spnSimulations, "cell 1 0");
    spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1)));
    new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000);

    JLabel lblSeedNumber = new JLabel("Seed number:");
    panelSimulations.add(lblSeedNumber, "cell 0 1");

    spnSeed = new JSpinner();
    panelSimulations.add(spnSeed, "cell 1 1");
    spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1)));
    new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188);

    JLabel lblResampling = new JLabel("Resampling:");
    panelSimulations.add(lblResampling, "cell 0 2");

    cboResampling = new JComboBox();
    panelSimulations.add(cboResampling, "cell 1 2");
    cboResampling
            .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" }));
    new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT);

    segmentationPanel = new SegmentationPanel();
    segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?");
    segmentationPanel.chkSegmentation.setEnabled(false);
    panelParameters.add(segmentationPanel, "cell 0 3,growx");

    JPanel panel_3 = new JPanel();
    panelParameters.add(panel_3, "cell 0 4,grow");
    panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]"));

    JButton btnReset = new JButton("Reset");
    btnReset.setActionCommand("Reset");
    btnReset.addActionListener(this);
    panel_3.add(btnReset, "cell 0 0,grow");

    JButton btnRunAnalysis = new JButton("Run Analysis");
    btnRunAnalysis.setAction(actionRun);
    panel_3.add(btnRunAnalysis, "cell 2 0,grow");

    JPanel panelResults = new JPanel();
    splitPaneMain.setRightComponent(panelResults);
    panelResults.setLayout(new BorderLayout(0, 0));

    splitPaneResults = new JSplitPane();
    splitPaneResults.setResizeWeight(0.5);
    splitPaneResults.setOneTouchExpandable(true);
    splitPaneResults.setDividerLocation(0.5d);
    panelResults.add(splitPaneResults, BorderLayout.CENTER);
    splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT);

    JPanel panelResultsTop = new JPanel();
    splitPaneResults.setLeftComponent(panelResultsTop);
    panelResultsTop.setLayout(new BorderLayout(0, 0));

    JPanel panelChartOptions = new JPanel();
    panelChartOptions.setBackground(Color.WHITE);
    panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH);
    panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]"));

    JLabel lblNewLabel = new JLabel("Plot:");
    panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center");

    cboChartMetric = new JComboBox();
    cboChartMetric.setEnabled(false);
    cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values()));
    panelChartOptions.add(cboChartMetric, "cell 1 0,growx");
    cboChartMetric.setBackground(Color.WHITE);

    JLabel lblOfSegment = new JLabel("of segment:");
    panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing");

    cboSegment = new JComboBox();
    cboSegment.setBackground(Color.WHITE);
    cboSegment.setActionCommand("UpdateChart");
    cboSegment.addActionListener(this);

    panelChartOptions.add(cboSegment, "cell 3 0,growx");
    cboChartMetric.setActionCommand("UpdateChart");

    JLabel lblWithAsymptoteType = new JLabel("with asymptote type:");
    panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing");

    JComboBox comboBox = new JComboBox();
    comboBox.setEnabled(false);
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten",
            "Modified Michaelis-Menten", "Logistic", "Modified exponential" }));
    comboBox.setBackground(Color.WHITE);
    panelChartOptions.add(comboBox, "cell 5 0,growx");
    cboChartMetric.addActionListener(this);

    panelChart = new JPanel();
    panelChart.setMinimumSize(new Dimension(200, 200));
    panelResultsTop.add(panelChart, BorderLayout.CENTER);
    panelChart.setLayout(new BorderLayout(0, 0));
    panelChart.setBackground(Color.WHITE);

    JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM);
    splitPaneResults.setRightComponent(panelResultsBottom);

    simulationsTable = new SSIZResultsTable();
    simulationsTable.setEnabled(false);
    simulationsTable.addMouseListener(new TablePopClickListener());
    simulationsTable.setVisibleRowCount(10);

    adapter = new JTableSpreadsheetByRowAdapter(simulationsTable);

    scrollPaneSimulations = new JScrollPane();
    panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null);
    scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneSimulations.setViewportView(simulationsTable);

    JPanel panelAsymptote = new JPanel();

    asymptoteTable = new AsymptoteTable();
    asymptoteTable.setEnabled(false);
    // asymptoteTable.addMouseListener(new TablePopClickListener());
    asymptoteTable.setVisibleRowCount(10);

    scrollPaneAsymptote = new JScrollPane();

    scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneAsymptote.setViewportView(asymptoteTable);
    panelAsymptote.setLayout(new BorderLayout());
    panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER);
    panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null);

    // Disable asymptote tab until it is implemented
    panelResultsBottom.setEnabledAt(1, false);

    panelProgressBar = new JPanel();
    panelProgressBar.setLayout(new BorderLayout());

    btnCancelAnalysis = new JButton("Cancel");
    btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png"));
    btnCancelAnalysis.setVisible(false);
    btnCancelAnalysis.setActionCommand("CancelAnalysis");
    btnCancelAnalysis.addActionListener(this);

    progressBar = new JProgressBar();
    panelProgressBar.add(progressBar, BorderLayout.CENTER);
    panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST);
    progressBar.setStringPainted(true);

    fileDialogWasUsed = false;
    mouseListenersActive = false;

    this.setGUIForFHFileReader();
    this.setGUIForThresholdStatus();

    pack();
    this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    setVisible(true);
}