Example usage for javax.swing JButton setText

List of usage examples for javax.swing JButton setText

Introduction

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

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The button's text.")
public void setText(String text) 

Source Link

Document

Sets the button's text.

Usage

From source file:org.jets3t.gui.ErrorDialog.java

/**
 * Initialises all GUI elements./*from ww w.  j  a v a  2  s.  co m*/
 */
private void initGui(String message, String details) {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(applicationProperties);

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);

    JHtmlLabel messageLabel = skinsFactory.createSkinnedJHtmlLabel("ErrorMessageLabel", hyperlinkListener);
    messageLabel.setText(message);
    messageLabel.setHorizontalAlignment(JLabel.CENTER);
    JHtmlLabel detailsLabel = skinsFactory.createSkinnedJHtmlLabel("ErrorDetailsLabel", hyperlinkListener);
    detailsLabel.setText(details);

    JButton okButton = skinsFactory.createSkinnedJButton("ErrorOkButton");
    okButton.setName("OK");
    okButton.setText("OK");
    okButton.addActionListener(this);
    this.getRootPane().setDefaultButton(okButton);

    JPanel dialogPanel = skinsFactory.createSkinnedJPanel("ErrorDialogPanel");

    int row = 0;
    dialogPanel.setLayout(new GridBagLayout());
    dialogPanel.add(messageLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(12, 5, 12, 5), 0, 0));
    dialogPanel.add(detailsLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    dialogPanel.add(okButton, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    this.getContentPane().add(dialogPanel);
    this.pack();
    this.setLocationRelativeTo(this.getOwner());
}

From source file:org.jets3t.gui.ItemPropertiesDialog.java

/**
 * Initialise the GUI elements to display the given item.
 *
 * @param s3Item//from  w  w  w .j av  a  2  s .c om
 * the S3Bucket or an S3Object whose details will be displayed
 */
private void initGui(boolean isObjectBased) {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(applicationProperties);

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    this.setResizable(true);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    JPanel commonPropertiesContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesCommonPanel");
    commonPropertiesContainer.setLayout(new GridBagLayout());
    JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesMetadataPanel");
    metadataContainer.setLayout(new GridBagLayout());
    JPanel grantsContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesGrantsPanel");
    grantsContainer.setLayout(new GridBagLayout());

    if (!isObjectBased) {
        // Display bucket details.
        JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
        bucketNameLabel.setText("Bucket name:");
        bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField");
        bucketNameTextField.setEditable(false);
        JLabel bucketLocationLabel = skinsFactory.createSkinnedJHtmlLabel("BucketLocationLabel");
        bucketLocationLabel.setText("Location:");
        bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField");
        bucketLocationTextField.setEditable(false);
        JLabel bucketCreationDateLabel = skinsFactory.createSkinnedJHtmlLabel("BucketCreationDateLabel");
        bucketCreationDateLabel.setText("Creation date:");
        bucketCreationDateTextField = skinsFactory.createSkinnedJTextField("BucketCreationDateTextField");
        bucketCreationDateTextField.setEditable(false);
        ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
        ownerNameLabel.setText("Owner name:");
        ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
        ownerNameTextField.setEditable(false);
        ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
        ownerIdLabel.setText("Owner ID:");
        ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
        ownerIdTextField.setEditable(false);

        bucketIsRequesterPaysLabel = skinsFactory.createSkinnedJHtmlLabel("BucketIsRequesterPaysLabel");
        bucketIsRequesterPaysLabel.setText("Requester Pays?");
        bucketIsRequesterPaysCheckBox = skinsFactory.createSkinnedJCheckBox("BucketIsRequesterPaysCheckBox");
        bucketIsRequesterPaysCheckBox.setEnabled(false);

        int row = 0;
        commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketLocationLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketCreationDateLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketCreationDateTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketIsRequesterPaysLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketIsRequesterPaysCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0,
                GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    } else {
        // Display object details.
        JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel");
        objectKeyLabel.setText("Object key:");
        objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField");
        objectKeyTextField.setEditable(false);
        JLabel objectContentTypeLabel = skinsFactory.createSkinnedJHtmlLabel("ContentTypeLabel");
        objectContentTypeLabel.setText("Content type:");
        objectContentTypeTextField = skinsFactory.createSkinnedJTextField("ContentTypeTextField");
        objectContentTypeTextField.setEditable(false);
        JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel");
        objectContentLengthLabel.setText("Size:");
        objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField");
        objectContentLengthTextField.setEditable(false);
        JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel");
        objectLastModifiedLabel.setText("Last modified:");
        objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField");
        objectLastModifiedTextField.setEditable(false);
        JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel");
        objectETagLabel.setText("ETag:");
        objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField");
        objectETagTextField.setEditable(false);
        JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
        bucketNameLabel.setText("Bucket name:");
        bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField");
        bucketNameTextField.setEditable(false);
        ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
        ownerNameLabel.setText("Owner name:");
        ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
        ownerNameTextField.setEditable(false);
        ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
        ownerIdLabel.setText("Owner ID:");
        ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
        ownerIdTextField.setEditable(false);

        commonPropertiesContainer.add(objectKeyLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectKeyTextField, new GridBagConstraints(1, 0, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectContentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectContentTypeTextField, new GridBagConstraints(1, 1, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectContentLengthLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectContentLengthTextField, new GridBagConstraints(1, 2, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectLastModifiedLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectLastModifiedTextField, new GridBagConstraints(1, 3, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectETagLabel, new GridBagConstraints(0, 4, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectETagTextField, new GridBagConstraints(1, 4, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, 5, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, 5, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, 7, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, 7, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, 8, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, 8, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        // Build metadata table.
        objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) {
            private static final long serialVersionUID = -3762866886166776851L;

            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        TableSorter metadataTableSorter = new TableSorter(objectMetadataTableModel);
        JTable metadataTable = skinsFactory.createSkinnedJTable("MetadataTable");
        metadataTable.setModel(metadataTableSorter);
        metadataTableSorter.setTableHeader(metadataTable.getTableHeader());
        metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));
    }

    // Build grants table.
    grantsTableModel = new DefaultTableModel(new Object[] { "Grantee", "Permission" }, 0) {
        private static final long serialVersionUID = -5882427163845726770L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    TableSorter grantsTableSorter = new TableSorter(grantsTableModel);
    grantsTable = skinsFactory.createSkinnedJTable("GrantsTable");
    grantsTable.setModel(grantsTableSorter);
    grantsTableSorter.setTableHeader(grantsTable.getTableHeader());
    grantsContainer.add(new JScrollPane(grantsTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // OK Button.
    JButton okButton = skinsFactory.createSkinnedJButton("ItemPropertiesOKButton");
    okButton.setText("Finished");
    okButton.setActionCommand("OK");
    okButton.addActionListener(this);

    // Set default ENTER button.
    this.getRootPane().setDefaultButton(okButton);

    // Put it all together.
    int row = 0;
    JPanel container = skinsFactory.createSkinnedJPanel("ItemPropertiesPanel");
    container.setLayout(new GridBagLayout());
    container.add(commonPropertiesContainer, new GridBagConstraints(0, row++, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    if (isObjectBased) {

        if (includeMetadata) {
            JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel");
            metadataLabel.setText("<html><b>Metadata</b></html>");
            metadataLabel.setHorizontalAlignment(JLabel.CENTER);
            container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                    GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
            container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1,
                    GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
        }

        // Object previous and next buttons, if we have multiple objects.
        previousObjectButton = skinsFactory.createSkinnedJButton("ItemPropertiesPreviousButton");
        previousObjectButton.setText("Previous");
        previousObjectButton.addActionListener(this);
        previousObjectButton.setEnabled(false);
        nextObjectButton = skinsFactory.createSkinnedJButton("ItemPropertiesNextButton");
        nextObjectButton.setText("Next");
        nextObjectButton.addActionListener(this);
        nextObjectButton.setEnabled(false);
        currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ItemPropertiesCurrentObjectLabel");
        currentObjectLabel.setHorizontalAlignment(JLabel.CENTER);

        nextPreviousPanel = skinsFactory.createSkinnedJPanel("ItemPropertiesNextPreviousPanel");
        nextPreviousPanel.setLayout(new GridBagLayout());
        nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 0, 0,
                GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
        nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
        nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0));

        container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
        row++;
    } else {
        JHtmlLabel grantsLabel = skinsFactory.createSkinnedJHtmlLabel("GrantsLabel");
        grantsLabel.setText("<html><b>Permissions</b></html>");
        grantsLabel.setHorizontalAlignment(JLabel.CENTER);
        container.add(grantsLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
        container.add(grantsContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, insetsZero, 0, 0));
    }
    container.add(okButton, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    this.getContentPane().add(container);

    this.pack();
    if (isObjectBased) {
        this.setSize(400, (includeMetadata ? 550 : 400));
    }
    this.setLocationRelativeTo(this.getOwner());
}

From source file:org.kepler.gui.PlotsEditorPanel.java

private JButton createAddPlotButton() {
    JButton button = new JButton();
    button.setText("New Plot");
    final PlotsEditorPanel me = this;
    FigureAction action = new FigureAction("add plot") {
        @Override/*from   ww  w  . j a v a  2  s .  c  o m*/
        public void actionPerformed(ActionEvent e) {
            me.addPlot();
        }
    };
    button.setAction(action);
    return button;
}

From source file:org.languagetool.gui.ConfigurationDialog.java

private JPanel getNgramPanel(GridBagConstraints cons) {
    JPanel panel = new JPanel();
    panel.add(new JLabel(messages.getString("guiNgramDir")), cons);
    File dir = config.getNgramDirectory();
    int maxDirDisplayLength = 45;
    String buttonText = dir != null ? StringUtils.abbreviate(dir.getAbsolutePath(), maxDirDisplayLength)
            : messages.getString("guiNgramDirSelect");
    JButton ngramDirButton = new JButton(buttonText);
    ngramDirButton.addActionListener(new ActionListener() {
        @Override//w ww .ja  v  a2  s .  c  o  m
        public void actionPerformed(ActionEvent e) {
            File newDir = Tools.openDirectoryDialog(owner, dir);
            if (newDir != null) {
                try {
                    if (config.getLanguage() != null) { // may happen in office context
                        File checkDir = new File(newDir, config.getLanguage().getShortCode());
                        LuceneLanguageModel.validateDirectory(checkDir);
                    }
                    config.setNgramDirectory(newDir);
                    ngramDirButton
                            .setText(StringUtils.abbreviate(newDir.getAbsolutePath(), maxDirDisplayLength));
                } catch (Exception ex) {
                    Tools.showErrorMessage(ex);
                }
            } else {
                // not the best UI, but this way user can turn off ngram feature without another checkbox
                config.setNgramDirectory(null);
                ngramDirButton.setText(
                        StringUtils.abbreviate(messages.getString("guiNgramDirSelect"), maxDirDisplayLength));
            }
        }
    });
    panel.add(ngramDirButton, cons);
    JButton helpButton = new JButton(messages.getString("guiNgramHelp"));
    helpButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Tools.openURL("http://wiki.languagetool.org/finding-errors-using-n-gram-data");
        }
    });
    panel.add(helpButton, cons);
    return panel;
}

From source file:org.languagetool.gui.ConfigurationDialog.java

private JPanel getWord2VecPanel(GridBagConstraints cons) {
    JPanel panel = new JPanel();
    panel.add(new JLabel(messages.getString("guiWord2VecDir")), cons);
    File dir = config.getWord2VecDirectory();
    int maxDirDisplayLength = 45;
    String buttonText = dir != null ? StringUtils.abbreviate(dir.getAbsolutePath(), maxDirDisplayLength)
            : messages.getString("guiWord2VecDirSelect");
    JButton word2vecDirButton = new JButton(buttonText);
    word2vecDirButton.addActionListener(e -> {
        File newDir = Tools.openDirectoryDialog(owner, dir);
        if (newDir != null) {
            try {
                config.setWord2VecDirectory(newDir);
                word2vecDirButton
                        .setText(StringUtils.abbreviate(newDir.getAbsolutePath(), maxDirDisplayLength));
            } catch (Exception ex) {
                Tools.showErrorMessage(ex);
            }//from   w  w  w. j a v  a 2  s. c  o  m
        } else {
            // not the best UI, but this way user can turn off word2vec feature without another checkbox
            config.setWord2VecDirectory(null);
            word2vecDirButton.setText(
                    StringUtils.abbreviate(messages.getString("guiWord2VecDirSelect"), maxDirDisplayLength));
        }
    });
    panel.add(word2vecDirButton, cons);
    JButton helpButton = new JButton(messages.getString("guiWord2VecHelp"));
    helpButton.addActionListener(e -> {
        Tools.openURL("https://github.com/gulp21/languagetool-neural-network");
    });
    panel.add(helpButton, cons);
    return panel;
}

From source file:org.micromanager.asidispim.AcquisitionPanel.java

public AcquisitionPanel(ScriptInterface gui, Devices devices, Properties props, Cameras cameras, Prefs prefs,
        StagePositionUpdater posUpdater, Positions positions, ControllerUtils controller,
        AutofocusUtils autofocus) {//from  w w w .j a  v  a 2 s  .c  o m
    super(MyStrings.PanelNames.ACQUSITION.toString(),
            new MigLayout("", "[center]0[center]0[center]", "0[top]0"));
    gui_ = gui;
    devices_ = devices;
    props_ = props;
    cameras_ = cameras;
    prefs_ = prefs;
    posUpdater_ = posUpdater;
    positions_ = positions;
    controller_ = controller;
    autofocus_ = autofocus;
    core_ = gui_.getMMCore();
    numTimePointsDone_ = 0;
    sliceTiming_ = new SliceTiming();
    lastAcquisitionPath_ = "";
    lastAcquisitionName_ = "";
    acq_ = null;
    channelNames_ = null;
    resetXaxisSpeed_ = true;
    acquisitionPanel_ = this;

    PanelUtils pu = new PanelUtils(prefs_, props_, devices_);

    // added to spinner controls where we should re-calculate the displayed
    // slice period, volume duration, and time lapse duration
    ChangeListener recalculateTimingDisplayCL = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            if (advancedSliceTimingCB_.isSelected()) {
                // need to update sliceTiming_ from property values
                sliceTiming_ = getTimingFromAdvancedSettings();
            }
            updateDurationLabels();
        }
    };

    // added to combobox controls where we should re-calculate the displayed
    // slice period, volume duration, and time lapse duration
    ActionListener recalculateTimingDisplayAL = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateDurationLabels();
        }
    };

    // start volume sub-panel

    volPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "4[]8[]"));

    volPanel_.setBorder(PanelUtils.makeTitledBorder("Volume Settings"));

    if (!ASIdiSPIM.oSPIM) {
    } else {
        props_.setPropValue(Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_NUM_SIDES, "1");
    }
    volPanel_.add(new JLabel("Number of sides:"));
    String[] str12 = { "1", "2" };
    numSides_ = pu.makeDropDownBox(str12, Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_NUM_SIDES, str12[1]);
    numSides_.addActionListener(recalculateTimingDisplayAL);
    if (!ASIdiSPIM.oSPIM) {
    } else {
        numSides_.setEnabled(false);
    }
    volPanel_.add(numSides_, "wrap");

    volPanel_.add(new JLabel("First side:"));
    String[] ab = { Devices.Sides.A.toString(), Devices.Sides.B.toString() };
    if (!ASIdiSPIM.oSPIM) {
    } else {
        props_.setPropValue(Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_FIRST_SIDE, Devices.Sides.A.toString());
    }
    firstSide_ = pu.makeDropDownBox(ab, Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_FIRST_SIDE,
            Devices.Sides.A.toString());
    firstSide_.addActionListener(recalculateTimingDisplayAL);
    if (!ASIdiSPIM.oSPIM) {
    } else {
        firstSide_.setEnabled(false);
    }
    volPanel_.add(firstSide_, "wrap");

    volPanel_.add(new JLabel("Delay before side [ms]:"));
    // used to read/write directly to galvo/micro-mirror firmware, but want different stage scan behavior
    delaySide_ = pu.makeSpinnerFloat(0, 10000, 0.25, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_DELAY_BEFORE_SIDE, 50);
    pu.addListenerLast(delaySide_, recalculateTimingDisplayCL);
    volPanel_.add(delaySide_, "wrap");

    volPanel_.add(new JLabel("Slices per side:"));
    numSlices_ = pu.makeSpinnerInteger(1, 65000, Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_NUM_SLICES, 20);
    pu.addListenerLast(numSlices_, recalculateTimingDisplayCL);
    volPanel_.add(numSlices_, "wrap");

    volPanel_.add(new JLabel("Slice step size [\u00B5m]:"));
    stepSize_ = pu.makeSpinnerFloat(0, 100, 0.1, Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_SLICE_STEP_SIZE,
            1.0);
    pu.addListenerLast(stepSize_, recalculateTimingDisplayCL); // needed only for stage scanning b/c acceleration time related to speed
    volPanel_.add(stepSize_, "wrap");

    // end volume sub-panel

    // start slice timing controls, have 2 options with advanced timing checkbox shared
    slicePanel_ = new JPanel(new MigLayout("", "[right]10[center]", "0[]0[]"));

    slicePanel_.setBorder(PanelUtils.makeTitledBorder("Slice Settings"));

    // start light sheet controls
    lightSheetPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "4[]8"));

    lightSheetPanel_.add(new JLabel("Scan reset time [ms]:"));
    JSpinner lsScanReset = pu.makeSpinnerFloat(1, 100, 0.25, // practical lower limit of 1ms
            Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_LS_SCAN_RESET, 3);
    lsScanReset.addChangeListener(PanelUtils.coerceToQuarterIntegers(lsScanReset));
    pu.addListenerLast(lsScanReset, recalculateTimingDisplayCL);
    lightSheetPanel_.add(lsScanReset, "wrap");

    lightSheetPanel_.add(new JLabel("Scan settle time [ms]:"));
    JSpinner lsScanSettle = pu.makeSpinnerFloat(0.25, 100, 0.25, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_LS_SCAN_SETTLE, 1);
    lsScanSettle.addChangeListener(PanelUtils.coerceToQuarterIntegers(lsScanSettle));
    pu.addListenerLast(lsScanSettle, recalculateTimingDisplayCL);
    lightSheetPanel_.add(lsScanSettle, "wrap");

    lightSheetPanel_.add(new JLabel("Shutter width [\u00B5m]:"));
    JSpinner lsShutterWidth = pu.makeSpinnerFloat(0.1, 100, 1, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_LS_SHUTTER_WIDTH, 5);
    pu.addListenerLast(lsShutterWidth, recalculateTimingDisplayCL);
    lightSheetPanel_.add(lsShutterWidth);

    //      lightSheetPanel_.add(new JLabel("1 / (shutter speed):"));
    //      JSpinner lsShutterSpeed = pu.makeSpinnerInteger(1, 10,
    //            Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_LS_SHUTTER_SPEED, 1);
    //      lightSheetPanel_.add(lsShutterSpeed, "wrap");

    // end light sheet controls

    // start "normal" (not light sheet) controls

    normalPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "4[]8"));

    // out of order so we can reference it
    desiredSlicePeriod_ = pu.makeSpinnerFloat(1, 1000, 0.25, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_DESIRED_SLICE_PERIOD, 30);

    minSlicePeriodCB_ = pu.makeCheckBox("Minimize slice period", Properties.Keys.PREFS_MINIMIZE_SLICE_PERIOD,
            panelName_, false);
    minSlicePeriodCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean doMin = minSlicePeriodCB_.isSelected();
            desiredSlicePeriod_.setEnabled(!doMin);
            desiredSlicePeriodLabel_.setEnabled(!doMin);
            recalculateSliceTiming(false);
        }
    });
    normalPanel_.add(minSlicePeriodCB_, "span 2, wrap");

    // special field that is enabled/disabled depending on whether advanced timing is enabled
    desiredSlicePeriodLabel_ = new JLabel("Slice period [ms]:");
    normalPanel_.add(desiredSlicePeriodLabel_);
    normalPanel_.add(desiredSlicePeriod_, "wrap");
    desiredSlicePeriod_.addChangeListener(PanelUtils.coerceToQuarterIntegers(desiredSlicePeriod_));
    desiredSlicePeriod_.addChangeListener(recalculateTimingDisplayCL);

    // special field that is enabled/disabled depending on whether advanced timing is enabled
    desiredLightExposureLabel_ = new JLabel("Sample exposure [ms]:");
    normalPanel_.add(desiredLightExposureLabel_);
    desiredLightExposure_ = pu.makeSpinnerFloat(1.0, 1000, 0.25, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_DESIRED_EXPOSURE, 8.5);
    desiredLightExposure_.addChangeListener(PanelUtils.coerceToQuarterIntegers(desiredLightExposure_));
    desiredLightExposure_.addChangeListener(recalculateTimingDisplayCL);
    normalPanel_.add(desiredLightExposure_);

    // end normal simple slice timing controls

    slicePanelContainer_ = new JPanel(new MigLayout("", "0[center]0", "0[]0"));
    slicePanelContainer_.add(
            getSPIMCameraMode() == CameraModes.Keys.LIGHT_SHEET ? lightSheetPanel_ : normalPanel_, "growx");
    slicePanel_.add(slicePanelContainer_, "span 2, center, wrap");

    // special checkbox to use the advanced timing settings
    // action handler added below after defining components it enables/disables
    advancedSliceTimingCB_ = pu.makeCheckBox("Use advanced timing settings",
            Properties.Keys.PREFS_ADVANCED_SLICE_TIMING, panelName_, false);
    slicePanel_.add(advancedSliceTimingCB_, "span 2, left");

    // end slice sub-panel

    // start advanced slice timing frame
    // visibility of this frame is controlled from advancedTiming checkbox
    // this frame is separate from main plugin window

    sliceFrameAdvanced_ = new MMFrame();
    sliceFrameAdvanced_.setTitle("Advanced timing");
    sliceFrameAdvanced_.loadPosition(100, 100);

    sliceAdvancedPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));
    sliceFrameAdvanced_.add(sliceAdvancedPanel_);

    class SliceFrameAdapter extends WindowAdapter {
        @Override
        public void windowClosing(WindowEvent e) {
            advancedSliceTimingCB_.setSelected(false);
            sliceFrameAdvanced_.savePosition();
        }
    }

    sliceFrameAdvanced_.addWindowListener(new SliceFrameAdapter());

    JLabel scanDelayLabel = new JLabel("Delay before scan [ms]:");
    sliceAdvancedPanel_.add(scanDelayLabel);
    delayScan_ = pu.makeSpinnerFloat(0, 10000, 0.25,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB }, Properties.Keys.SPIM_DELAY_SCAN,
            0);
    delayScan_.addChangeListener(PanelUtils.coerceToQuarterIntegers(delayScan_));
    delayScan_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(delayScan_, "wrap");

    JLabel lineScanLabel = new JLabel("Lines scans per slice:");
    sliceAdvancedPanel_.add(lineScanLabel);
    numScansPerSlice_ = pu.makeSpinnerInteger(1, 1000,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB },
            Properties.Keys.SPIM_NUM_SCANSPERSLICE, 1);
    numScansPerSlice_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(numScansPerSlice_, "wrap");

    JLabel lineScanPeriodLabel = new JLabel("Line scan duration [ms]:");
    sliceAdvancedPanel_.add(lineScanPeriodLabel);
    lineScanDuration_ = pu.makeSpinnerFloat(1, 10000, 0.25,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB }, Properties.Keys.SPIM_DURATION_SCAN,
            10);
    lineScanDuration_.addChangeListener(PanelUtils.coerceToQuarterIntegers(lineScanDuration_));
    lineScanDuration_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(lineScanDuration_, "wrap");

    JLabel delayLaserLabel = new JLabel("Delay before laser [ms]:");
    sliceAdvancedPanel_.add(delayLaserLabel);
    delayLaser_ = pu.makeSpinnerFloat(0, 10000, 0.25,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB }, Properties.Keys.SPIM_DELAY_LASER,
            0);
    delayLaser_.addChangeListener(PanelUtils.coerceToQuarterIntegers(delayLaser_));
    delayLaser_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(delayLaser_, "wrap");

    JLabel durationLabel = new JLabel("Laser trig duration [ms]:");
    sliceAdvancedPanel_.add(durationLabel);
    durationLaser_ = pu.makeSpinnerFloat(0, 10000, 0.25,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB },
            Properties.Keys.SPIM_DURATION_LASER, 1);
    durationLaser_.addChangeListener(PanelUtils.coerceToQuarterIntegers(durationLaser_));
    durationLaser_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(durationLaser_, "span 2, wrap");

    JLabel delayLabel = new JLabel("Delay before camera [ms]:");
    sliceAdvancedPanel_.add(delayLabel);
    delayCamera_ = pu.makeSpinnerFloat(0, 10000, 0.25,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB }, Properties.Keys.SPIM_DELAY_CAMERA,
            0);
    delayCamera_.addChangeListener(PanelUtils.coerceToQuarterIntegers(delayCamera_));
    delayCamera_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(delayCamera_, "wrap");

    JLabel cameraLabel = new JLabel("Camera trig duration [ms]:");
    sliceAdvancedPanel_.add(cameraLabel);
    durationCamera_ = pu.makeSpinnerFloat(0, 1000, 0.25,
            new Devices.Keys[] { Devices.Keys.GALVOA, Devices.Keys.GALVOB },
            Properties.Keys.SPIM_DURATION_CAMERA, 0);
    durationCamera_.addChangeListener(PanelUtils.coerceToQuarterIntegers(durationCamera_));
    durationCamera_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(durationCamera_, "wrap");

    JLabel exposureLabel = new JLabel("Camera exposure [ms]:");
    sliceAdvancedPanel_.add(exposureLabel);
    exposureCamera_ = pu.makeSpinnerFloat(0, 1000, 0.25, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_ADVANCED_CAMERA_EXPOSURE, 10f);
    exposureCamera_.addChangeListener(recalculateTimingDisplayCL);
    sliceAdvancedPanel_.add(exposureCamera_, "wrap");

    alternateBeamScanCB_ = pu.makeCheckBox("Alternate scan direction",
            Properties.Keys.PREFS_SCAN_OPPOSITE_DIRECTIONS, panelName_, false);
    sliceAdvancedPanel_.add(alternateBeamScanCB_, "center, span 2, wrap");

    simpleTimingComponents_ = new JComponent[] { desiredLightExposure_, minSlicePeriodCB_,
            desiredSlicePeriodLabel_, desiredLightExposureLabel_ };
    final JComponent[] advancedTimingComponents = { delayScan_, numScansPerSlice_, lineScanDuration_,
            delayLaser_, durationLaser_, delayCamera_, durationCamera_, exposureCamera_, alternateBeamScanCB_ };
    PanelUtils.componentsSetEnabled(advancedTimingComponents, advancedSliceTimingCB_.isSelected());
    PanelUtils.componentsSetEnabled(simpleTimingComponents_, !advancedSliceTimingCB_.isSelected());

    // this action listener takes care of enabling/disabling inputs
    // of the advanced slice timing window
    // we call this to get GUI looking right
    ItemListener sliceTimingDisableGUIInputs = new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean enabled = advancedSliceTimingCB_.isSelected();
            // set other components in this advanced timing frame
            PanelUtils.componentsSetEnabled(advancedTimingComponents, enabled);
            // also control some components in main volume settings sub-panel
            PanelUtils.componentsSetEnabled(simpleTimingComponents_, !enabled);
            desiredSlicePeriod_.setEnabled(!enabled && !minSlicePeriodCB_.isSelected());
            desiredSlicePeriodLabel_.setEnabled(!enabled && !minSlicePeriodCB_.isSelected());
            updateDurationLabels();
        }

    };

    // this action listener shows/hides the advanced timing frame
    ActionListener showAdvancedTimingFrame = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean enabled = advancedSliceTimingCB_.isSelected();
            if (enabled) {
                sliceFrameAdvanced_.setVisible(enabled);
            }
        }
    };

    sliceFrameAdvanced_.pack();
    sliceFrameAdvanced_.setResizable(false);

    // end slice Frame

    // start repeat (time lapse) sub-panel

    timepointPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));

    useTimepointsCB_ = pu.makeCheckBox("Time points", Properties.Keys.PREFS_USE_TIMEPOINTS, panelName_, false);
    useTimepointsCB_.setToolTipText("Perform a time-lapse acquisition");
    useTimepointsCB_.setEnabled(true);
    useTimepointsCB_.setFocusPainted(false);
    ComponentTitledBorder componentBorder = new ComponentTitledBorder(useTimepointsCB_, timepointPanel_,
            BorderFactory.createLineBorder(ASIdiSPIM.borderColor));
    timepointPanel_.setBorder(componentBorder);

    ChangeListener recalculateTimeLapseDisplay = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            updateActualTimeLapseDurationLabel();
        }
    };

    useTimepointsCB_.addChangeListener(recalculateTimeLapseDisplay);

    timepointPanel_.add(new JLabel("Number:"));
    numTimepoints_ = pu.makeSpinnerInteger(1, 100000, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_NUM_ACQUISITIONS, 1);
    numTimepoints_.addChangeListener(recalculateTimeLapseDisplay);
    numTimepoints_.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            // update nrRepeats_ variable so the acquisition can be extended or shortened
            //   as long as we have separate timepoints
            if (acquisitionRunning_.get() && getSavingSeparateFile()) {
                nrRepeats_ = getNumTimepoints();
            }
        }
    });
    timepointPanel_.add(numTimepoints_, "wrap");

    timepointPanel_.add(new JLabel("Interval [s]:"));
    acquisitionInterval_ = pu.makeSpinnerFloat(0.1, 32000, 0.1, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_ACQUISITION_INTERVAL, 60);
    acquisitionInterval_.addChangeListener(recalculateTimeLapseDisplay);
    timepointPanel_.add(acquisitionInterval_, "wrap");

    // enable/disable panel elements depending on checkbox state
    useTimepointsCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PanelUtils.componentsSetEnabled(timepointPanel_, useTimepointsCB_.isSelected());
        }
    });
    PanelUtils.componentsSetEnabled(timepointPanel_, useTimepointsCB_.isSelected()); // initialize

    // end repeat sub-panel

    // start savePanel

    // TODO for now these settings aren't part of acquisition settings
    // TODO consider whether that should be changed

    final int textFieldWidth = 16;
    savePanel_ = new JPanel(new MigLayout("", "[right]10[center]8[left]", "[]4[]"));
    savePanel_.setBorder(PanelUtils.makeTitledBorder("Data Saving Settings"));

    separateTimePointsCB_ = pu.makeCheckBox("Separate viewer / file for each time point",
            Properties.Keys.PREFS_SEPARATE_VIEWERS_FOR_TIMEPOINTS, panelName_, false);

    saveCB_ = pu.makeCheckBox("Save while acquiring", Properties.Keys.PREFS_SAVE_WHILE_ACQUIRING, panelName_,
            false);

    // make sure that when separate viewer is enabled then saving gets enabled too
    separateTimePointsCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (separateTimePointsCB_.isSelected() && !saveCB_.isSelected()) {
                saveCB_.doClick(); // setSelected() won't work because need to call its listener
            }
        }
    });
    savePanel_.add(separateTimePointsCB_, "span 3, left, wrap");
    savePanel_.add(saveCB_, "skip 1, span 2, center, wrap");

    JLabel dirRootLabel = new JLabel("Directory root:");
    savePanel_.add(dirRootLabel);

    DefaultFormatter formatter = new DefaultFormatter();
    formatter.setOverwriteMode(false);
    rootField_ = new JFormattedTextField(formatter);
    rootField_.setText(prefs_.getString(panelName_, Properties.Keys.PLUGIN_DIRECTORY_ROOT, ""));
    rootField_.addPropertyChangeListener(new PropertyChangeListener() {
        // will respond to commitEdit() as well as GUI edit on commit
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            prefs_.putString(panelName_, Properties.Keys.PLUGIN_DIRECTORY_ROOT, rootField_.getText());
        }
    });
    rootField_.setColumns(textFieldWidth);
    savePanel_.add(rootField_, "span 2");

    JButton browseRootButton = new JButton();
    browseRootButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            setRootDirectory(rootField_);
            prefs_.putString(panelName_, Properties.Keys.PLUGIN_DIRECTORY_ROOT, rootField_.getText());
        }
    });
    browseRootButton.setMargin(new Insets(2, 5, 2, 5));
    browseRootButton.setText("...");
    savePanel_.add(browseRootButton, "wrap");

    JLabel namePrefixLabel = new JLabel();
    namePrefixLabel.setText("Name prefix:");
    savePanel_.add(namePrefixLabel);

    prefixField_ = new JFormattedTextField(formatter);
    prefixField_.setText(prefs_.getString(panelName_, Properties.Keys.PLUGIN_NAME_PREFIX, "acq"));
    prefixField_.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            prefs_.putString(panelName_, Properties.Keys.PLUGIN_NAME_PREFIX, prefixField_.getText());
        }
    });
    prefixField_.setColumns(textFieldWidth);
    savePanel_.add(prefixField_, "span 2, wrap");

    // since we use the name field even for acquisitions in RAM, 
    // we only need to gray out the directory-related components
    final JComponent[] saveComponents = { browseRootButton, rootField_, dirRootLabel };
    PanelUtils.componentsSetEnabled(saveComponents, saveCB_.isSelected());

    saveCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PanelUtils.componentsSetEnabled(saveComponents, saveCB_.isSelected());
        }
    });

    // end save panel

    // start duration report panel

    durationPanel_ = new JPanel(new MigLayout("", "[right]6[left, 40%!]", "[]5[]"));
    durationPanel_.setBorder(PanelUtils.makeTitledBorder("Durations"));
    durationPanel_.setPreferredSize(new Dimension(125, 0)); // fix width so it doesn't constantly change depending on text

    durationPanel_.add(new JLabel("Slice:"));
    actualSlicePeriodLabel_ = new JLabel();
    durationPanel_.add(actualSlicePeriodLabel_, "wrap");

    durationPanel_.add(new JLabel("Volume:"));
    actualVolumeDurationLabel_ = new JLabel();
    durationPanel_.add(actualVolumeDurationLabel_, "wrap");

    durationPanel_.add(new JLabel("Total:"));
    actualTimeLapseDurationLabel_ = new JLabel();
    durationPanel_.add(actualTimeLapseDurationLabel_, "wrap");

    // end duration report panel

    buttonTestAcq_ = new JButton("Test Acquisition");
    buttonTestAcq_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            runTestAcquisition(Devices.Sides.NONE);
        }
    });

    buttonStart_ = new JToggleButton();
    buttonStart_.setIconTextGap(6);
    buttonStart_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (isAcquisitionRequested()) {
                stopAcquisition();
            } else {
                runAcquisition();
            }
        }
    });
    updateStartButton(); // call once to initialize, isSelected() will be false

    // make the size of the test button match the start button (easier on the eye)
    Dimension sizeStart = buttonStart_.getPreferredSize();
    Dimension sizeTest = buttonTestAcq_.getPreferredSize();
    sizeTest.height = sizeStart.height;
    buttonTestAcq_.setPreferredSize(sizeTest);

    acquisitionStatusLabel_ = new JLabel("");
    acquisitionStatusLabel_.setBackground(prefixField_.getBackground());
    acquisitionStatusLabel_.setOpaque(true);
    updateAcquisitionStatus(AcquisitionStatus.NONE);

    // Channel Panel (separate file for code)
    multiChannelPanel_ = new MultiChannelSubPanel(gui, devices_, props_, prefs_);
    multiChannelPanel_.addDurationLabelListener(this);

    // Position Panel
    final JPanel positionPanel = new JPanel();
    positionPanel.setLayout(new MigLayout("flowx, fillx", "[right]10[left][10][]", "[]8[]"));
    usePositionsCB_ = pu.makeCheckBox("Multiple positions (XY)", Properties.Keys.PREFS_USE_MULTIPOSITION,
            panelName_, false);
    usePositionsCB_.setToolTipText("Acquire datasest at multiple postions");
    usePositionsCB_.setEnabled(true);
    usePositionsCB_.setFocusPainted(false);
    componentBorder = new ComponentTitledBorder(usePositionsCB_, positionPanel,
            BorderFactory.createLineBorder(ASIdiSPIM.borderColor));
    positionPanel.setBorder(componentBorder);

    usePositionsCB_.addChangeListener(recalculateTimingDisplayCL);

    final JButton editPositionListButton = new JButton("Edit position list...");
    editPositionListButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            gui_.showXYPositionList();
        }
    });
    positionPanel.add(editPositionListButton);

    gridButton_ = new JButton("XYZ grid...");
    positionPanel.add(gridButton_, "wrap");

    // start XYZ grid frame
    // visibility of this frame is controlled from XYZ grid button
    // this frame is separate from main plugin window

    gridXPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));

    useXGridCB_ = pu.makeCheckBox("Slices from stage coordinates", Properties.Keys.PREFS_USE_X_GRID, panelName_,
            true);
    useXGridCB_.setEnabled(true);
    useXGridCB_.setFocusPainted(false);
    componentBorder = new ComponentTitledBorder(useXGridCB_, gridXPanel_,
            BorderFactory.createLineBorder(ASIdiSPIM.borderColor));
    gridXPanel_.setBorder(componentBorder);

    // enable/disable panel elements depending on checkbox state
    useXGridCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PanelUtils.componentsSetEnabled(gridXPanel_, useXGridCB_.isSelected());
        }
    });

    gridXPanel_.add(new JLabel("X start [um]:"));
    gridXStartField_ = pu.makeFloatEntryField(panelName_, "Grid_X_Start", -400, 5);
    gridXStartField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridXCount();
        }
    });
    gridXPanel_.add(gridXStartField_);
    JButton tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            gridXStartField_.setValue(positions_.getUpdatedPosition(Devices.Keys.XYSTAGE, Directions.X));
            updateGridXCount();
        }
    });
    gridXPanel_.add(tmp_but, "wrap");

    gridXPanel_.add(new JLabel("X stop [um]:"));
    gridXStopField_ = pu.makeFloatEntryField(panelName_, "Grid_X_Stop", 400, 5);
    gridXStopField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridXCount();
        }
    });
    gridXPanel_.add(gridXStopField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            gridXStopField_.setValue(positions_.getUpdatedPosition(Devices.Keys.XYSTAGE, Directions.X));
            updateGridXCount();
        }
    });
    gridXPanel_.add(tmp_but, "wrap");

    gridXPanel_.add(new JLabel("X delta [um]:"));
    gridXDeltaField_ = pu.makeFloatEntryField(panelName_, "Grid_X_Delta", 3, 5);
    gridXDeltaField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridXCount();
        }
    });
    gridXPanel_.add(gridXDeltaField_, "wrap");
    //      tmp_but = new JButton("Set");
    //      tmp_but.setBackground(Color.red);
    //      tmp_but.addActionListener(new ActionListener() {
    //         @Override
    //         public void actionPerformed(ActionEvent arg0) {
    //            // TODO figure out spacing, maybe to make reslicing trivial
    //            updateGridXCount();
    //         }
    //      });
    //      gridPanel_.add(tmp_but, "wrap");

    gridXPanel_.add(new JLabel("Slice count:"));
    gridXCount_ = new JLabel("");
    gridXPanel_.add(gridXCount_, "wrap");
    updateGridXCount();
    PanelUtils.componentsSetEnabled(gridXPanel_, useXGridCB_.isSelected()); // initialize

    gridYPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));

    useYGridCB_ = pu.makeCheckBox("Grid in Y", Properties.Keys.PREFS_USE_Y_GRID, panelName_, true);
    useYGridCB_.setEnabled(true);
    useYGridCB_.setFocusPainted(false);
    componentBorder = new ComponentTitledBorder(useYGridCB_, gridYPanel_,
            BorderFactory.createLineBorder(ASIdiSPIM.borderColor));
    gridYPanel_.setBorder(componentBorder);

    // enable/disable panel elements depending on checkbox state
    useYGridCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PanelUtils.componentsSetEnabled(gridYPanel_, useYGridCB_.isSelected());
        }
    });

    gridYPanel_.add(new JLabel("Y start [um]:"));
    gridYStartField_ = pu.makeFloatEntryField(panelName_, "Grid_Y_Start", -1200, 5);
    gridYStartField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridYCount();
        }
    });
    gridYPanel_.add(gridYStartField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            gridYStartField_.setValue(positions_.getUpdatedPosition(Devices.Keys.XYSTAGE, Directions.Y));
            updateGridYCount();
        }
    });
    gridYPanel_.add(tmp_but, "wrap");

    gridYPanel_.add(new JLabel("Y stop [um]:"));
    gridYStopField_ = pu.makeFloatEntryField(panelName_, "Grid_Y_Stop", 1200, 5);
    gridYStopField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridYCount();
        }
    });
    gridYPanel_.add(gridYStopField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            gridYStopField_.setValue(positions_.getUpdatedPosition(Devices.Keys.XYSTAGE, Directions.Y));
            updateGridYCount();
        }
    });
    gridYPanel_.add(tmp_but, "wrap");

    gridYPanel_.add(new JLabel("Y delta [um]:"));
    gridYDeltaField_ = pu.makeFloatEntryField(panelName_, "Grid_Y_Delta", 700, 5);
    gridYDeltaField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridYCount();
        }
    });
    gridYPanel_.add(gridYDeltaField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            Devices.Keys camKey = isFirstSideA() ? Devices.Keys.CAMERAA : Devices.Keys.CAMERAB;
            int height;
            try {
                height = core_.getROI(devices_.getMMDevice(camKey)).height;
            } catch (Exception e) {
                height = 1;
            }
            float pixelSize = (float) core_.getPixelSizeUm();
            double delta = height * pixelSize;
            double overlap = props_.getPropValueFloat(Devices.Keys.PLUGIN,
                    Properties.Keys.PLUGIN_GRID_OVERLAP_PERCENT);
            delta *= (1 - overlap / 100);
            // sanity checks, would be better handled with exceptions or more formal checks
            if (height > 4100 || height < 4 || pixelSize < 1e-6) {
                return;
            }
            gridYDeltaField_.setValue(Math.round(delta));
            updateGridYCount();
        }
    });
    gridYPanel_.add(tmp_but, "wrap");

    gridYPanel_.add(new JLabel("Y count:"));
    gridYCount_ = new JLabel("");
    gridYPanel_.add(gridYCount_, "wrap");
    updateGridYCount();
    PanelUtils.componentsSetEnabled(gridYPanel_, useYGridCB_.isSelected()); // initialize

    gridZPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));

    useZGridCB_ = pu.makeCheckBox("Grid in Z", Properties.Keys.PREFS_USE_Z_GRID, panelName_, true);
    useZGridCB_.setEnabled(true);
    useZGridCB_.setFocusPainted(false);
    componentBorder = new ComponentTitledBorder(useZGridCB_, gridZPanel_,
            BorderFactory.createLineBorder(ASIdiSPIM.borderColor));
    gridZPanel_.setBorder(componentBorder);

    // enable/disable panel elements depending on checkbox state
    useZGridCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PanelUtils.componentsSetEnabled(gridZPanel_, useZGridCB_.isSelected());
        }
    });

    gridZPanel_.add(new JLabel("Z start [um]:"));
    gridZStartField_ = pu.makeFloatEntryField(panelName_, "Grid_Z_Start", 0, 5);
    gridZStartField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridZCount();
        }
    });
    gridZPanel_.add(gridZStartField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            gridZStartField_.setValue(positions_.getUpdatedPosition(Devices.Keys.UPPERZDRIVE));
            updateGridZCount();
        }
    });
    gridZPanel_.add(tmp_but, "wrap");

    gridZPanel_.add(new JLabel("Z stop [um]:"));
    gridZStopField_ = pu.makeFloatEntryField(panelName_, "Grid_Z_Stop", -800, 5);
    gridZStopField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridZCount();
        }
    });
    gridZPanel_.add(gridZStopField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            gridZStopField_.setValue(positions_.getUpdatedPosition(Devices.Keys.UPPERZDRIVE));
            updateGridZCount();
        }
    });
    gridZPanel_.add(tmp_but, "wrap");

    gridZPanel_.add(new JLabel("Z delta [um]:"));
    gridZDeltaField_ = pu.makeFloatEntryField(panelName_, "Grid_Z_Delta", 400, 5);
    gridZDeltaField_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            updateGridZCount();
        }
    });
    gridZPanel_.add(gridZDeltaField_);
    tmp_but = new JButton("Set");
    tmp_but.setBackground(Color.red);
    tmp_but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            Devices.Keys camKey = isFirstSideA() ? Devices.Keys.CAMERAA : Devices.Keys.CAMERAB;
            int width;
            try {
                width = core_.getROI(devices_.getMMDevice(camKey)).width;
            } catch (Exception e) {
                width = 1;
            }
            float pixelSize = (float) core_.getPixelSizeUm();
            // sanity checks, would be better handled with exceptions or more formal checks
            if (width > 4100 || width < 4 || pixelSize < 1e-6) {
                return;
            }
            double delta = width * pixelSize / Math.sqrt(2);
            double overlap = props_.getPropValueFloat(Devices.Keys.PLUGIN,
                    Properties.Keys.PLUGIN_GRID_OVERLAP_PERCENT);
            delta *= (1 - overlap / 100);
            gridZDeltaField_.setValue(Math.round(delta));
            updateGridZCount();
        }
    });
    gridZPanel_.add(tmp_but, "wrap");

    gridZPanel_.add(new JLabel("Z count:"));
    gridZCount_ = new JLabel("");
    gridZPanel_.add(gridZCount_, "wrap");
    updateGridZCount();
    PanelUtils.componentsSetEnabled(gridZPanel_, useZGridCB_.isSelected()); // initialize

    gridSettingsPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));

    gridSettingsPanel_.setBorder(PanelUtils.makeTitledBorder("Grid settings"));
    gridSettingsPanel_.add(new JLabel("Overlap (Y and Z) [%]:"));
    JSpinner tileOverlapPercent = pu.makeSpinnerFloat(0, 100, 1, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_GRID_OVERLAP_PERCENT, 10);
    gridSettingsPanel_.add(tileOverlapPercent, "wrap");
    clearYZGridCB_ = pu.makeCheckBox("Clear position list if YZ unused", Properties.Keys.PREFS_CLEAR_YZ_GRID,
            panelName_, true);
    gridSettingsPanel_.add(clearYZGridCB_, "span 2");

    computeGridButton_ = new JButton("Compute grid");
    computeGridButton_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            final boolean useX = useXGridCB_.isSelected();
            final boolean useY = useYGridCB_.isSelected();
            final boolean useZ = useZGridCB_.isSelected();
            final int numX = useX ? updateGridXCount() : 1;
            final int numY = useY ? updateGridYCount() : 1;
            final int numZ = useZ ? updateGridZCount() : 1;
            double centerX = (((Double) gridXStartField_.getValue()) + ((Double) gridXStopField_.getValue()))
                    / 2;
            double centerY = (((Double) gridYStartField_.getValue()) + ((Double) gridYStopField_.getValue()))
                    / 2;
            double centerZ = (((Double) gridZStartField_.getValue()) + ((Double) gridZStopField_.getValue()))
                    / 2;
            double deltaX = (Double) gridXDeltaField_.getValue();
            double deltaY = (Double) gridYDeltaField_.getValue();
            double deltaZ = (Double) gridZDeltaField_.getValue();
            double startY = centerY - deltaY * (numY - 1) / 2;
            double startZ = centerZ - deltaZ * (numZ - 1) / 2;
            String xy_device = devices_.getMMDevice(Devices.Keys.XYSTAGE);
            String z_device = devices_.getMMDevice(Devices.Keys.UPPERZDRIVE);

            if (useX) {
                try {
                    setVolumeSliceStepSize(Math.abs(deltaX) / Math.sqrt(2));
                    setVolumeSlicesPerVolume(numX);
                    if (!useY && !useZ) {
                        // move to X center if we aren't generating position list with it
                        positions_.setPosition(Devices.Keys.XYSTAGE, Directions.X, centerX);
                    }
                } catch (Exception ex) {
                    // not sure what to do in case of error so ignore
                }
            } else {
                // use current X value as center; this was original behavior
                centerX = positions_.getUpdatedPosition(Devices.Keys.XYSTAGE, Directions.X);
            }

            // if we aren't using one axis, use the current position instead of GUI position
            if (useY && !useZ) {
                startZ = positions_.getUpdatedPosition(Devices.Keys.UPPERZDRIVE);
            }
            if (useZ && !useY) {
                startY = positions_.getUpdatedPosition(Devices.Keys.XYSTAGE, Directions.Y);
            }

            if (!useY && !useZ && !clearYZGridCB_.isSelected()) {
                return;
            }

            PositionList pl;
            try {
                pl = gui_.getPositionList();
            } catch (MMScriptException e) {
                pl = new PositionList();
            }
            boolean isPositionListEmpty = pl.getNumberOfPositions() == 0;
            if (!isPositionListEmpty) {
                boolean overwrite = MyDialogUtils.getConfirmDialogResult(
                        "Do you really want to overwrite the existing position list?",
                        JOptionPane.YES_NO_OPTION);
                if (!overwrite) {
                    return; // nothing to do
                }
            }
            pl = new PositionList();
            if (useY || useZ) {
                for (int iZ = 0; iZ < numZ; ++iZ) {
                    for (int iY = 0; iY < numY; ++iY) {
                        MultiStagePosition msp = new MultiStagePosition();
                        StagePosition s = new StagePosition();
                        s.stageName = xy_device;
                        s.numAxes = 2;
                        s.x = centerX;
                        s.y = startY + iY * deltaY;
                        msp.add(s);
                        StagePosition s2 = new StagePosition();
                        s2.stageName = z_device;
                        s2.x = startZ + iZ * deltaZ;
                        msp.add(s2);
                        msp.setLabel("Pos_" + iZ + "_" + iY);
                        pl.addPosition(msp);
                    }
                }
            }
            try {
                gui_.setPositionList(pl);
            } catch (MMScriptException ex) {
                MyDialogUtils.showError(ex, "Couldn't overwrite position list with generated YZ grid");
            }
        }
    });

    gridFrame_ = new MMFrame();
    gridFrame_.setTitle("XYZ Grid");
    gridFrame_.loadPosition(100, 100);

    gridPanel_ = new JPanel(new MigLayout("", "[right]10[center]", "[]8[]"));
    gridFrame_.add(gridPanel_);

    class GridFrameAdapter extends WindowAdapter {
        @Override
        public void windowClosing(WindowEvent e) {
            gridButton_.setSelected(false);
            gridFrame_.savePosition();
        }
    }

    gridFrame_.addWindowListener(new GridFrameAdapter());

    gridButton_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            gridFrame_.setVisible(true);
        }
    });

    gridPanel_.add(gridYPanel_);
    gridPanel_.add(gridZPanel_, "wrap");
    gridPanel_.add(gridXPanel_, "spany 2");
    gridPanel_.add(gridSettingsPanel_, "growx, wrap");
    gridPanel_.add(computeGridButton_, "growx, growy");
    gridFrame_.pack();
    gridFrame_.setResizable(false);

    // end YZ grid frame

    positionPanel.add(new JLabel("Post-move delay [ms]:"));
    positionDelay_ = pu.makeSpinnerFloat(0.0, 10000.0, 100.0, Devices.Keys.PLUGIN,
            Properties.Keys.PLUGIN_POSITION_DELAY, 0.0);
    positionPanel.add(positionDelay_, "wrap");

    // enable/disable panel elements depending on checkbox state
    usePositionsCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PanelUtils.componentsSetEnabled(positionPanel, usePositionsCB_.isSelected());
            gridButton_.setEnabled(true); // leave this always enabled
        }
    });
    PanelUtils.componentsSetEnabled(positionPanel, usePositionsCB_.isSelected()); // initialize
    gridButton_.setEnabled(true); // leave this always enabled

    // end of Position panel

    // checkbox to use navigation joystick settings or not
    // an "orphan" UI element
    navigationJoysticksCB_ = new JCheckBox("Use Navigation joystick settings");
    navigationJoysticksCB_
            .setSelected(prefs_.getBoolean(panelName_, Properties.Keys.PLUGIN_USE_NAVIGATION_JOYSTICKS, false));
    navigationJoysticksCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateJoysticks();
            prefs_.putBoolean(panelName_, Properties.Keys.PLUGIN_USE_NAVIGATION_JOYSTICKS,
                    navigationJoysticksCB_.isSelected());
        }
    });

    // checkbox to signal that autofocus should be used during acquisition
    // another orphan UI element
    useAutofocusCB_ = new JCheckBox("Autofocus periodically");
    useAutofocusCB_
            .setSelected(prefs_.getBoolean(panelName_, Properties.Keys.PLUGIN_ACQUSITION_USE_AUTOFOCUS, false));
    useAutofocusCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            prefs_.putBoolean(panelName_, Properties.Keys.PLUGIN_ACQUSITION_USE_AUTOFOCUS,
                    useAutofocusCB_.isSelected());
        }
    });

    // checkbox to signal that movement should be corrected during acquisition
    // Yet another orphan UI element
    useMovementCorrectionCB_ = new JCheckBox("Motion correction");
    useMovementCorrectionCB_.setSelected(
            prefs_.getBoolean(panelName_, Properties.Keys.PLUGIN_ACQUSITION_USE_MOVEMENT_CORRECTION, false));
    useMovementCorrectionCB_.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            prefs_.putBoolean(panelName_, Properties.Keys.PLUGIN_ACQUSITION_USE_MOVEMENT_CORRECTION,
                    useMovementCorrectionCB_.isSelected());
        }
    });

    // set up tabbed panels for GUI
    // make 3 columns as own JPanels to get vertical space right
    // in each column without dependencies on other columns

    leftColumnPanel_ = new JPanel(new MigLayout("", "[]", "[]6[]10[]10[]"));

    leftColumnPanel_.add(durationPanel_, "split 2");
    leftColumnPanel_.add(timepointPanel_, "wrap, growx");
    leftColumnPanel_.add(savePanel_, "wrap");
    leftColumnPanel_.add(new JLabel("Acquisition mode: "), "split 2, right");
    AcquisitionModes acqModes = new AcquisitionModes(devices_, prefs_);
    spimMode_ = acqModes.getComboBox();
    spimMode_.addActionListener(recalculateTimingDisplayAL);
    leftColumnPanel_.add(spimMode_, "left, wrap");
    leftColumnPanel_.add(buttonStart_, "split 3, left");
    leftColumnPanel_.add(new JLabel("    "));
    leftColumnPanel_.add(buttonTestAcq_, "wrap");
    leftColumnPanel_.add(new JLabel("Status:"), "split 2, left");
    leftColumnPanel_.add(acquisitionStatusLabel_);

    centerColumnPanel_ = new JPanel(new MigLayout("", "[]", "[]"));

    centerColumnPanel_.add(positionPanel, "growx, wrap");
    centerColumnPanel_.add(multiChannelPanel_, "wrap");
    centerColumnPanel_.add(navigationJoysticksCB_, "wrap");
    centerColumnPanel_.add(useAutofocusCB_, "split 2");
    centerColumnPanel_.add(useMovementCorrectionCB_);

    rightColumnPanel_ = new JPanel(new MigLayout("", "[center]0", "[]0[]"));

    rightColumnPanel_.add(volPanel_, "growx, wrap");
    rightColumnPanel_.add(slicePanel_, "growx");

    // add the column panels to the main panel
    super.add(leftColumnPanel_);
    super.add(centerColumnPanel_);
    super.add(rightColumnPanel_);

    // properly initialize the advanced slice timing
    advancedSliceTimingCB_.addItemListener(sliceTimingDisableGUIInputs);
    sliceTimingDisableGUIInputs.itemStateChanged(null);
    advancedSliceTimingCB_.addActionListener(showAdvancedTimingFrame);

    // included is calculating slice timing
    updateDurationLabels();

    // update local variables
    zStepUm_ = PanelUtils.getSpinnerFloatValue(stepSize_);
    refreshXYZPositions();

}

From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection HardCodedStringLiteral/*w  w  w.  j a  va2 s  . com*/
 */
private void $$$setupUI$$$() {
    m_mainPanel = new JPanel();
    m_mainPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(7, 1, new Insets(0, 0, 0, 0), -1, -1));
    m_mainPanel.add(panel1,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel2,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel2.setBorder(BorderFactory.createTitledBorder("Platform"));
    final JScrollPane scrollPane1 = new JScrollPane();
    panel2.add(scrollPane1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    m_platforms = new JList();
    scrollPane1.setViewportView(m_platforms);
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel3,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel3.setBorder(BorderFactory.createTitledBorder("Options"));
    m_startGui = new JCheckBox();
    m_startGui.setText("Start GUI");
    panel3.add(m_startGui,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_runClean = new JCheckBox();
    m_runClean.setText("Run Clean");
    panel3.add(m_runClean,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JScrollPane scrollPane2 = new JScrollPane();
    panel1.add(scrollPane2,
            new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    scrollPane2.setBorder(BorderFactory.createTitledBorder("System Properties"));
    m_systemProperties = new JTable();
    m_systemProperties.setEnabled(true);
    scrollPane2.setViewportView(m_systemProperties);
    final JPanel panel4 = new JPanel();
    panel4.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel4,
            new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel4.setBorder(BorderFactory.createTitledBorder("Proxy"));
    final JLabel label1 = new JLabel();
    label1.setText("Port:");
    panel4.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setText("Username:");
    panel4.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("Password:");
    panel4.add(label3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_proxyHost = new JTextField();
    panel4.add(m_proxyHost,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_proxyPort = new JTextField();
    panel4.add(m_proxyPort,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_proxyUser = new JTextField();
    panel4.add(m_proxyUser,
            new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_proxyPass = new JPasswordField();
    panel4.add(m_proxyPass,
            new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label4 = new JLabel();
    label4.setHorizontalAlignment(10);
    label4.setHorizontalTextPosition(10);
    label4.setText("Host:");
    panel4.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel5 = new JPanel();
    panel5.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel5,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JLabel label5 = new JLabel();
    label5.setText("Working Dir:");
    panel5.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_workDir = new JTextField();
    panel5.add(m_workDir,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_selectDir = new JButton();
    m_selectDir.setText("...");
    panel5.add(m_selectDir,
            new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel6 = new JPanel();
    panel6.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel6,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JLabel label6 = new JLabel();
    label6.setText("VM Arguments:");
    panel6.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_vmArguments = new JTextField();
    panel6.add(m_vmArguments,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JPanel panel7 = new JPanel();
    panel7.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel7,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JLabel label7 = new JLabel();
    label7.setText("JDK:");
    panel7.add(label7, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_jdk = new JTextField();
    m_jdk.setEditable(false);
    panel7.add(m_jdk,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JPanel panel8 = new JPanel();
    panel8.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
    m_mainPanel.add(panel8,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel8.setBorder(BorderFactory.createTitledBorder("Bundles"));
    final JPanel panel9 = new JPanel();
    panel9.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1));
    panel8.add(panel9,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    JButton add = new JButton();
    add.setText("Add...");
    panel9.add(add,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JScrollPane scrollPane3 = new JScrollPane();
    panel8.add(scrollPane3,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    scrollPane3.setBorder(BorderFactory.createTitledBorder("Properties"));
    m_bundleProperties = new JTable();
    scrollPane3.setViewportView(m_bundleProperties);
    final JScrollPane scrollPane4 = new JScrollPane();
    panel8.add(scrollPane4,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    m_bundles = new JList();
    scrollPane4.setViewportView(m_bundles);
    final JPanel panel10 = new JPanel();
    panel10.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel8.add(panel10,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel10.setBorder(BorderFactory.createTitledBorder("Description"));
    m_description = new JTextArea();
    panel10.add(m_description,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null,
                    new Dimension(150, 50), null, 0, false));
}

From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WarehouseManagement.java

/**
 * Initialize the contents of the frame//from   w ww  .j  ava2 s  .c  o  m
 */
private void initialize() {

    final JTabbedPane tabbedPane;
    final JPanel deliveryPanel;
    final JLabel entryDateLabel;
    final JLabel entryDateLabel_1;
    final JLabel entryDateLabel_2;
    final JLabel entryDateLabel_3;
    final JLabel entryDateLabel_3_1;
    final JLabel entryDateLabel_3_2;
    final JPanel shipmentPanel;
    final JLabel entryDateLabel_3_1_1;
    final JLabel entryDateLabel_3_1_2;
    final JScrollPane scrollPane;
    final JButton printReportButton;
    final JButton saveReportButton;
    final JButton activateDoorButton;
    final JButton deactivateDoorButton;
    final JButton clearReportButton;
    final JPanel panel;
    final JLabel entryDateLabel_3_3;
    final JLabel entryDateLabel_2_1;
    frame = new JFrame();
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setTitle("Warehouse Management");
    frame.setBounds(100, 100, 1011, 625);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    tabbedPane = new JTabbedPane();
    frame.getContentPane().add(tabbedPane);

    deliveryPanel = new JPanel();
    deliveryPanel.setLayout(null);
    tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null);

    entryDateLabel = new JLabel();
    entryDateLabel.setText("Entry Date .........");
    entryDateLabel.setBounds(533, 23, 117, 16);
    deliveryPanel.add(entryDateLabel);

    entryDateLabel_1 = new JLabel();
    entryDateLabel_1.setText("User ID ................");
    entryDateLabel_1.setBounds(10, 94, 117, 16);
    deliveryPanel.add(entryDateLabel_1);

    entryDateLabel_2 = new JLabel();
    entryDateLabel_2.setText("Invoice ID ............");
    entryDateLabel_2.setBounds(10, 23, 117, 16);
    deliveryPanel.add(entryDateLabel_2);

    entryDateLabel_3 = new JLabel();
    entryDateLabel_3.setText("Warehouse ID....");
    entryDateLabel_3.setBounds(10, 45, 117, 16);
    deliveryPanel.add(entryDateLabel_3);

    entryDateLabel_3_1 = new JLabel();
    entryDateLabel_3_1.setText("Zone ID ................");
    entryDateLabel_3_1.setBounds(10, 67, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1);

    entryDateLabel_3_2 = new JLabel();
    entryDateLabel_3_2.setText("Entry Hour .........");
    entryDateLabel_3_2.setBounds(533, 45, 117, 16);
    deliveryPanel.add(entryDateLabel_3_2);

    entryDateLabel_3_1_1 = new JLabel();
    entryDateLabel_3_1_1.setText("Offering Date ....");
    entryDateLabel_3_1_1.setBounds(533, 70, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1_1);

    entryDateLabel_3_1_2 = new JLabel();
    entryDateLabel_3_1_2.setText("Offering Hour ....");
    entryDateLabel_3_1_2.setBounds(533, 94, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1_2);

    invoiceIDTextField = new JTextField();
    invoiceIDTextField.setBounds(105, 19, 365, 20);
    deliveryPanel.add(invoiceIDTextField);

    warehouseIDTextField = new JTextField();
    warehouseIDTextField.setBounds(105, 43, 365, 20);
    deliveryPanel.add(warehouseIDTextField);

    zoneIDTextField = new JTextField();
    zoneIDTextField.setBounds(105, 66, 365, 20);
    deliveryPanel.add(zoneIDTextField);

    userIDTextField = new JTextField();
    userIDTextField.setBounds(105, 90, 365, 20);
    deliveryPanel.add(userIDTextField);

    entryDateTextField = new JTextField();
    entryDateTextField.setBounds(623, 19, 365, 20);
    deliveryPanel.add(entryDateTextField);

    entryHourTextField = new JTextField();
    entryHourTextField.setBounds(623, 41, 365, 20);
    deliveryPanel.add(entryHourTextField);

    offeringDateTextField = new JTextField();
    offeringDateTextField.setBounds(623, 66, 365, 20);
    deliveryPanel.add(offeringDateTextField);

    offeringHourTextField = new JTextField();
    offeringHourTextField.setBounds(623, 90, 365, 20);
    deliveryPanel.add(offeringHourTextField);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 129, 978, 355);
    deliveryPanel.add(scrollPane);

    deliveryTableModel = new DefaultTableModel();// All Clients Items
    deliveryTableModel.addColumn("Company");
    deliveryTableModel.addColumn("Item Code");
    deliveryTableModel.addColumn("Description");
    deliveryTableModel.addColumn("Quantity Delivered");
    deliveryTableModel.addColumn("Expected Quantity");
    deliveryTableModel.addColumn("Quantity Remain");
    deliveryTableModel.addColumn("Delivery Date");
    deliveryTableModel.addColumn("Measurement ID");
    deliveryTableModel.addColumn("Quantity");
    deliveryTable = new JTable(deliveryTableModel);
    deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10));
    deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    scrollPane.setViewportView(deliveryTable);

    ListSelectionModel rowSM = deliveryTable.getSelectionModel();

    printReportButton = new JButton();
    printReportButton.setText("Print Report");
    printReportButton.setBounds(860, 520, 117, 26);
    deliveryPanel.add(printReportButton);

    saveReportButton = new JButton();
    saveReportButton.setText("Save Report");
    saveReportButton.setBounds(614, 520, 117, 26);
    deliveryPanel.add(saveReportButton);

    activateDoorButton = new JButton();
    activateDoorButton.addMouseListener(new ActivateDoorButtonMouseListener());
    activateDoorButton.setText("Activate Door");
    activateDoorButton.setBounds(50, 520, 117, 26);
    deliveryPanel.add(activateDoorButton);

    deactivateDoorButton = new JButton();
    deactivateDoorButton.addMouseListener(new DeactivateDoorButtonMouseListener());
    deactivateDoorButton.setText("Dectivate Door");
    deactivateDoorButton.setBounds(173, 520, 117, 26);
    deliveryPanel.add(deactivateDoorButton);

    clearReportButton = new JButton();
    clearReportButton.addMouseListener(new ClearReportButtonMouseListener());
    clearReportButton.setText("Clear Report");
    clearReportButton.setBounds(737, 520, 117, 26);
    deliveryPanel.add(clearReportButton);
    rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            // Ignore extra messages.
            if (e.getValueIsAdjusting())
                return;

            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            if (lsm.isSelectionEmpty()) {
                // no rows are selected
            } else {
                selectedRow = lsm.getMinSelectionIndex();
                System.out.println("selectedRow = " + selectedRow);

            }
        }
    });

    shipmentPanel = new JPanel();
    tabbedPane.addTab("Shipment", null, shipmentPanel, null);

    panel = new JPanel();
    panel.setLayout(null);
    tabbedPane.addTab("Door Config", null, panel, null);

    aleListeningPortTextField = new JTextField();
    aleListeningPortTextField.setText("9999");
    aleListeningPortTextField.setBounds(172, 41, 330, 20);
    panel.add(aleListeningPortTextField);

    epcisRepositoryURLTextField = new JTextField();
    epcisRepositoryURLTextField.setText("http://localhost:8080/aspire0.3.0EpcisRepository/capture");
    epcisRepositoryURLTextField.setBounds(172, 65, 330, 20);
    panel.add(epcisRepositoryURLTextField);

    entryDateLabel_3_3 = new JLabel();
    entryDateLabel_3_3.setText("EPCIS Rep. URL .........");
    entryDateLabel_3_3.setBounds(51, 67, 117, 16);
    panel.add(entryDateLabel_3_3);

    entryDateLabel_2_1 = new JLabel();
    entryDateLabel_2_1.setText("ALE Listening Port ....");
    entryDateLabel_2_1.setBounds(51, 43, 117, 16);
    panel.add(entryDateLabel_2_1);

}

From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WMS.java

/**
 * Initialize the contents of the frame//from   w w w .  ja  v  a 2  s  . c  om
 */
private void initialize() {

    final JLabel entryDateLabel_2;
    final JLabel entryDateLabel_3_1_1;
    final JScrollPane scrollPane;
    final JButton printReportButton;
    final JButton saveReportButton;
    final JButton clearReportButton;
    frame = new JFrame();
    frame.setResizable(false);
    frame.addWindowListener(new FrameWindowListener());
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setTitle("Warehouse Management");
    frame.setBounds(100, 100, 757, 625);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    tabbedPane = new JTabbedPane();
    frame.getContentPane().add(tabbedPane);

    deliveryTableModel = new DefaultTableModel();// All Clients Items
    deliveryTableModel.addColumn("Company");
    deliveryTableModel.addColumn("Item Code");
    deliveryTableModel.addColumn("Description");
    deliveryTableModel.addColumn("Quantity Delivered");
    deliveryTableModel.addColumn("Expected Quantity");
    deliveryTableModel.addColumn("Quantity Remain");
    deliveryTableModel.addColumn("Delivery Date");
    deliveryTableModel.addColumn("Measurement ID");

    deliveryInfoModel = new DefaultTableModel();// All Clients Items
    deliveryInfoModel.addColumn("Company");
    deliveryInfoModel.addColumn("Item Code");
    deliveryInfoModel.addColumn("Description");
    deliveryInfoModel.addColumn("Expected Quantity");
    deliveryInfoModel.addColumn("Measurement ID");

    shipmentPanel = new JPanel();
    shipmentPanel.setLayout(null);
    tabbedPane.addTab("Shipment", null, shipmentPanel, null);

    submitShipmentButton = new JButton();
    submitShipmentButton.addActionListener(new SubmitShipmentButtonActionListener());

    submitShipmentButton.setText("Submit");
    submitShipmentButton.setBounds(275, 89, 112, 25);
    shipmentPanel.add(submitShipmentButton);

    final JLabel selectAvaiableInvoiceLabel = new JLabel();
    selectAvaiableInvoiceLabel.setText("Select avaiable invoice to track");
    selectAvaiableInvoiceLabel.setBounds(58, 26, 195, 15);
    shipmentPanel.add(selectAvaiableInvoiceLabel);

    shipmentsCb = new JComboBox();
    shipmentsCb.setModel(new DefaultComboBoxModel(new String[] {}));
    shipmentsCb.setSelectedItem(null);
    shipmentsCb.addActionListener(new ShipmentsCbActionListener());
    shipmentsCb.setBounds(269, 21, 382, 24);
    shipmentPanel.add(shipmentsCb);

    final JPanel panel = new JPanel();
    panel.setLayout(null);
    panel.setBorder(new TitledBorder(null, "Shipment information", TitledBorder.DEFAULT_JUSTIFICATION,
            TitledBorder.DEFAULT_POSITION, null, null));
    panel.setBounds(10, 170, 722, 327);
    shipmentPanel.add(panel);

    final JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(10, 27, 702, 300);
    panel.add(scrollPane_1);

    deliveryInfo = new JTable(deliveryInfoModel);
    deliveryInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane_1.setViewportView(deliveryInfo);

    deliveryPanel = new JPanel();
    deliveryPanel.setLayout(null);
    tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null);

    entryDateLabel_2 = new JLabel();
    entryDateLabel_2.setText("Invoice ID ");
    entryDateLabel_2.setBounds(10, 23, 117, 16);
    deliveryPanel.add(entryDateLabel_2);

    entryDateLabel_3_1_1 = new JLabel();
    entryDateLabel_3_1_1.setText("Offering Date");
    entryDateLabel_3_1_1.setBounds(391, 25, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1_1);

    invoiceIDTextField = new JTextField();
    invoiceIDTextField.setEditable(false);
    invoiceIDTextField.setBounds(105, 21, 270, 20);
    deliveryPanel.add(invoiceIDTextField);

    offeringDateTextField = new JTextField();
    offeringDateTextField.setEditable(false);
    offeringDateTextField.setBounds(511, 23, 230, 20);
    deliveryPanel.add(offeringDateTextField);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 81, 731, 403);
    deliveryPanel.add(scrollPane);
    deliveryTable = new JTable(deliveryTableModel);
    deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10));
    deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    scrollPane.setViewportView(deliveryTable);

    printReportButton = new JButton();
    printReportButton.setText("Print Report");
    printReportButton.setBounds(459, 520, 117, 26);
    deliveryPanel.add(printReportButton);

    saveReportButton = new JButton();
    saveReportButton.setText("Save Report");
    saveReportButton.setBounds(213, 520, 117, 26);
    deliveryPanel.add(saveReportButton);

    clearReportButton = new JButton();
    clearReportButton.addMouseListener(new ClearReportButtonMouseListener());
    clearReportButton.setText("Clear Report");
    clearReportButton.setBounds(336, 520, 117, 26);
    deliveryPanel.add(clearReportButton);

}

From source file:org.photovault.swingui.BrowserWindow.java

/**
 Create the toolbar for this browser window.
 *///from w ww . ja  v a  2 s . com
protected JToolBar createToolbar() {
    JToolBar tb = new JToolBar();

    JButton importBtn = new JButton(importAction);
    importBtn.setText("");
    JButton indexBtn = new JButton(viewCtrl.getActionAdapter("new_ext_vol"));
    indexBtn.setText("");
    JButton updateBtn = new JButton(viewCtrl.getActionAdapter("update_indexed_dirs"));
    updateBtn.setText("");
    JButton exportBtn = new JButton(viewPane.getExportSelectedAction());
    exportBtn.setText("");
    JButton deleteBtn = new JButton(viewPane.getDeleteSelectedAction());
    deleteBtn.setText("");

    JButton rotCWBtn = new JButton(viewCtrl.getActionAdapter("rotate_cw"));
    rotCWBtn.setText("");
    JButton rotCCWBtn = new JButton(viewCtrl.getActionAdapter("rotate_ccw"));
    rotCCWBtn.setText("");
    JButton rot180Btn = new JButton(viewCtrl.getActionAdapter("rotate_180"));
    rot180Btn.setText("");
    JButton cropBtn = new JButton(previewPane.getCropAction());
    cropBtn.setText("");
    JButton colorsBtn = new JButton(viewPane.getEditSelectionColorsAction());
    colorsBtn.setText("");

    JButton nextBtn = new JButton(viewPane.getSelectNextAction());
    nextBtn.setText("");
    JButton prevBtn = new JButton(viewPane.getSelectPreviousAction());
    prevBtn.setText("");
    JButton previewRightBtn = new JButton(getActionAdapter("view_preview_right"));
    previewRightBtn.setText("");
    JButton previewTopBtn = new JButton(getActionAdapter("view_preview_top"));
    previewTopBtn.setText("");
    JButton previewNoneBtn = new JButton(getActionAdapter("view_no_preview"));
    previewNoneBtn.setText("");

    ZoomComboBox zoomCombo = new ZoomComboBox(previewPane);

    tb.add(importBtn);
    tb.add(indexBtn);
    tb.add(updateBtn);
    tb.add(exportBtn);
    tb.add(deleteBtn);
    tb.addSeparator();
    tb.add(prevBtn);
    tb.add(nextBtn);
    tb.add(previewRightBtn);
    tb.add(previewTopBtn);
    tb.add(previewNoneBtn);
    tb.add(zoomCombo);
    tb.addSeparator();
    tb.add(rotCWBtn);
    tb.add(rotCCWBtn);
    tb.add(rot180Btn);
    tb.add(cropBtn);
    tb.add(colorsBtn);

    return tb;
}