Example usage for javax.swing.event ChangeListener ChangeListener

List of usage examples for javax.swing.event ChangeListener ChangeListener

Introduction

In this page you can find the example usage for javax.swing.event ChangeListener ChangeListener.

Prototype

ChangeListener

Source Link

Usage

From source file:org.jivesoftware.sparkimpl.plugin.viewer.PluginViewer.java

public PluginViewer() {
    _prefs = SettingsManager.getLocalPreferences();
    _deactivatedPlugins = _prefs.getDeactivatedPlugins();

    EventQueue.invokeLater(new Runnable() {

        public void run() {

            tabbedPane = new JTabbedPane();
            installedPanel = new JPanel();
            availablePanel = new JPanel();
            deactivatedPanel = new JPanel();
            setLayout(new GridBagLayout());

            installedPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
            installedPanel.setBackground(Color.white);

            availablePanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
            availablePanel.setBackground(Color.white);

            // Add TabbedPane
            add(tabbedPane, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.WEST,
                    GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

            // Add Tabs
            tabbedPane.addTab(Res.getString("tab.installed.plugins"), new JScrollPane(installedPanel));
            if (!Default.getBoolean(Default.INSTALL_PLUGINS_DISABLED)) {
                tabbedPane.addTab(Res.getString("tab.available.plugins"), new JScrollPane(availablePanel));
            }//  w ww.  j a v a2 s.  c o  m

            loadInstalledPlugins();
            loadDeactivatedPlugins();

            tabbedPane.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    if (tabbedPane.getSelectedComponent()
                            .equals(((JViewport) availablePanel.getParent()).getParent())) {
                        loadAvailablePlugins();
                        loaded = true;
                    }
                }
            });
        }
    });
}

From source file:org.jtrfp.trcl.gui.ConfigWindow.java

public ConfigWindow() {
    setTitle("Settings");
    setSize(340, 540);/*from   w ww  .  j  a  va2  s.co  m*/
    if (config == null)
        config = new TRConfiguration();
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    JPanel generalTab = new JPanel();
    tabbedPane.addTab("General",
            new ImageIcon(ConfigWindow.class
                    .getResource("/org/freedesktop/tango/22x22/mimetypes/application-x-executable.png")),
            generalTab, null);
    GridBagLayout gbl_generalTab = new GridBagLayout();
    gbl_generalTab.columnWidths = new int[] { 0, 0 };
    gbl_generalTab.rowHeights = new int[] { 0, 188, 222, 0 };
    gbl_generalTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_generalTab.rowWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
    generalTab.setLayout(gbl_generalTab);

    JPanel settingsLoadSavePanel = new JPanel();
    GridBagConstraints gbc_settingsLoadSavePanel = new GridBagConstraints();
    gbc_settingsLoadSavePanel.insets = new Insets(0, 0, 5, 0);
    gbc_settingsLoadSavePanel.anchor = GridBagConstraints.WEST;
    gbc_settingsLoadSavePanel.gridx = 0;
    gbc_settingsLoadSavePanel.gridy = 0;
    generalTab.add(settingsLoadSavePanel, gbc_settingsLoadSavePanel);
    settingsLoadSavePanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Overall Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    FlowLayout flowLayout_1 = (FlowLayout) settingsLoadSavePanel.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);

    JButton btnSave = new JButton("Export...");
    btnSave.setToolTipText("Export these settings to an external file");
    settingsLoadSavePanel.add(btnSave);
    btnSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            exportSettings();
        }
    });

    JButton btnLoad = new JButton("Import...");
    btnLoad.setToolTipText("Import an external settings file");
    settingsLoadSavePanel.add(btnLoad);
    btnLoad.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            importSettings();
        }
    });

    JButton btnConfigReset = new JButton("Reset");
    btnConfigReset.setToolTipText("Reset all settings to defaults");
    settingsLoadSavePanel.add(btnConfigReset);
    btnConfigReset.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            defaultSettings();
        }
    });

    JPanel registeredPODsPanel = new JPanel();
    registeredPODsPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Registered PODs", TitledBorder.LEFT, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_registeredPODsPanel = new GridBagConstraints();
    gbc_registeredPODsPanel.insets = new Insets(0, 0, 5, 0);
    gbc_registeredPODsPanel.fill = GridBagConstraints.BOTH;
    gbc_registeredPODsPanel.gridx = 0;
    gbc_registeredPODsPanel.gridy = 1;
    generalTab.add(registeredPODsPanel, gbc_registeredPODsPanel);
    GridBagLayout gbl_registeredPODsPanel = new GridBagLayout();
    gbl_registeredPODsPanel.columnWidths = new int[] { 272, 0 };
    gbl_registeredPODsPanel.rowHeights = new int[] { 76, 0, 0 };
    gbl_registeredPODsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_registeredPODsPanel.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    registeredPODsPanel.setLayout(gbl_registeredPODsPanel);

    JPanel podListPanel = new JPanel();
    GridBagConstraints gbc_podListPanel = new GridBagConstraints();
    gbc_podListPanel.insets = new Insets(0, 0, 5, 0);
    gbc_podListPanel.fill = GridBagConstraints.BOTH;
    gbc_podListPanel.gridx = 0;
    gbc_podListPanel.gridy = 0;
    registeredPODsPanel.add(podListPanel, gbc_podListPanel);
    podListPanel.setLayout(new BorderLayout(0, 0));

    JScrollPane podListScrollPane = new JScrollPane();
    podListPanel.add(podListScrollPane, BorderLayout.CENTER);

    podList = new JList(podLM);
    podList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    podListScrollPane.setViewportView(podList);

    JPanel podListOpButtonPanel = new JPanel();
    podListOpButtonPanel.setBorder(null);
    GridBagConstraints gbc_podListOpButtonPanel = new GridBagConstraints();
    gbc_podListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_podListOpButtonPanel.gridx = 0;
    gbc_podListOpButtonPanel.gridy = 1;
    registeredPODsPanel.add(podListOpButtonPanel, gbc_podListOpButtonPanel);
    FlowLayout flowLayout = (FlowLayout) podListOpButtonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);

    JButton addPodButton = new JButton("Add...");
    addPodButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addPodButton.setToolTipText("Add a POD to the registry to be considered when running a game.");
    podListOpButtonPanel.add(addPodButton);
    addPodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addPOD();
        }
    });

    JButton removePodButton = new JButton("Remove");
    removePodButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removePodButton.setToolTipText("Remove a POD file from being considered when playing a game");
    podListOpButtonPanel.add(removePodButton);
    removePodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            podLM.removeElement(podList.getSelectedValue());
        }
    });

    JButton podEditButton = new JButton("Edit...");
    podEditButton.setIcon(null);
    podEditButton.setToolTipText("Edit the selected POD path");
    podListOpButtonPanel.add(podEditButton);
    podEditButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editPODPath();
        }
    });

    JPanel missionPanel = new JPanel();
    GridBagConstraints gbc_missionPanel = new GridBagConstraints();
    gbc_missionPanel.fill = GridBagConstraints.BOTH;
    gbc_missionPanel.gridx = 0;
    gbc_missionPanel.gridy = 2;
    generalTab.add(missionPanel, gbc_missionPanel);
    missionPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Missions",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagLayout gbl_missionPanel = new GridBagLayout();
    gbl_missionPanel.columnWidths = new int[] { 0, 0 };
    gbl_missionPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_missionPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_missionPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    missionPanel.setLayout(gbl_missionPanel);

    JScrollPane scrollPane = new JScrollPane();
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 0;
    missionPanel.add(scrollPane, gbc_scrollPane);

    missionList = new JList(missionLM);
    missionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(missionList);

    JPanel missionListOpButtonPanel = new JPanel();
    GridBagConstraints gbc_missionListOpButtonPanel = new GridBagConstraints();
    gbc_missionListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_missionListOpButtonPanel.gridx = 0;
    gbc_missionListOpButtonPanel.gridy = 1;
    missionPanel.add(missionListOpButtonPanel, gbc_missionListOpButtonPanel);

    JButton addVOXButton = new JButton("Add...");
    addVOXButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addVOXButton.setToolTipText("Add an external VOX file as a mission");
    missionListOpButtonPanel.add(addVOXButton);
    addVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addVOX();
        }
    });

    final JButton removeVOXButton = new JButton("Remove");
    removeVOXButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removeVOXButton.setToolTipText("Remove the selected mission");
    missionListOpButtonPanel.add(removeVOXButton);
    removeVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            missionLM.remove(missionList.getSelectedIndex());
        }
    });

    final JButton editVOXButton = new JButton("Edit...");
    editVOXButton.setToolTipText("Edit the selected Mission's VOX path");
    missionListOpButtonPanel.add(editVOXButton);
    editVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editVOXPath();
        }
    });

    missionList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            final String val = (String) missionList.getSelectedValue();
            if (val == null)
                missionList.setSelectedIndex(0);
            else if (isBuiltinVOX(val)) {
                removeVOXButton.setEnabled(false);
                editVOXButton.setEnabled(false);
            } else {
                removeVOXButton.setEnabled(true);
                editVOXButton.setEnabled(true);
            }
        }
    });

    JPanel soundTab = new JPanel();
    tabbedPane.addTab("Sound",
            new ImageIcon(
                    ConfigWindow.class.getResource("/org/freedesktop/tango/22x22/devices/audio-card.png")),
            soundTab, null);
    GridBagLayout gbl_soundTab = new GridBagLayout();
    gbl_soundTab.columnWidths = new int[] { 0, 0 };
    gbl_soundTab.rowHeights = new int[] { 65, 51, 70, 132, 0, 0, 0 };
    gbl_soundTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_soundTab.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    soundTab.setLayout(gbl_soundTab);

    JPanel checkboxPanel = new JPanel();
    GridBagConstraints gbc_checkboxPanel = new GridBagConstraints();
    gbc_checkboxPanel.insets = new Insets(0, 0, 5, 0);
    gbc_checkboxPanel.fill = GridBagConstraints.BOTH;
    gbc_checkboxPanel.gridx = 0;
    gbc_checkboxPanel.gridy = 0;
    soundTab.add(checkboxPanel, gbc_checkboxPanel);

    chckbxLinearInterpolation = new JCheckBox("Linear Filtering");
    chckbxLinearInterpolation.setToolTipText("Use the GPU's TMU to smooth playback of low-rate samples.");
    chckbxLinearInterpolation.setHorizontalAlignment(SwingConstants.LEFT);
    checkboxPanel.add(chckbxLinearInterpolation);

    chckbxLinearInterpolation.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            needRestart = true;
        }
    });

    chckbxBufferLag = new JCheckBox("Buffer Lag");
    chckbxBufferLag.setToolTipText("Improves efficiency, doubles latency.");
    checkboxPanel.add(chckbxBufferLag);

    JPanel modStereoWidthPanel = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) modStereoWidthPanel.getLayout();
    flowLayout_2.setAlignment(FlowLayout.LEFT);
    modStereoWidthPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "MOD Stereo Width", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_modStereoWidthPanel = new GridBagConstraints();
    gbc_modStereoWidthPanel.anchor = GridBagConstraints.NORTH;
    gbc_modStereoWidthPanel.insets = new Insets(0, 0, 5, 0);
    gbc_modStereoWidthPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_modStereoWidthPanel.gridx = 0;
    gbc_modStereoWidthPanel.gridy = 1;
    soundTab.add(modStereoWidthPanel, gbc_modStereoWidthPanel);

    modStereoWidthSlider = new JSlider();
    modStereoWidthSlider.setPaintTicks(true);
    modStereoWidthSlider.setMinorTickSpacing(25);
    modStereoWidthPanel.add(modStereoWidthSlider);

    final JLabel modStereoWidthLbl = new JLabel("NN%");
    modStereoWidthPanel.add(modStereoWidthLbl);

    JPanel bufferSizePanel = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) bufferSizePanel.getLayout();
    flowLayout_3.setAlignment(FlowLayout.LEFT);
    bufferSizePanel.setBorder(
            new TitledBorder(null, "Buffer Size", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_bufferSizePanel = new GridBagConstraints();
    gbc_bufferSizePanel.anchor = GridBagConstraints.NORTH;
    gbc_bufferSizePanel.insets = new Insets(0, 0, 5, 0);
    gbc_bufferSizePanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_bufferSizePanel.gridx = 0;
    gbc_bufferSizePanel.gridy = 2;
    soundTab.add(bufferSizePanel, gbc_bufferSizePanel);

    audioBufferSizeCB = new JComboBox();
    audioBufferSizeCB.setModel(new DefaultComboBoxModel(AudioBufferSize.values()));
    bufferSizePanel.add(audioBufferSizeCB);

    soundOutputSelectorGUI = new SoundOutputSelectorGUI();
    soundOutputSelectorGUI.setBorder(
            new TitledBorder(null, "Output Driver", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_soundOutputSelectorGUI = new GridBagConstraints();
    gbc_soundOutputSelectorGUI.anchor = GridBagConstraints.NORTH;
    gbc_soundOutputSelectorGUI.insets = new Insets(0, 0, 5, 0);
    gbc_soundOutputSelectorGUI.fill = GridBagConstraints.HORIZONTAL;
    gbc_soundOutputSelectorGUI.gridx = 0;
    gbc_soundOutputSelectorGUI.gridy = 3;
    soundTab.add(soundOutputSelectorGUI, gbc_soundOutputSelectorGUI);

    modStereoWidthSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            modStereoWidthLbl.setText(modStereoWidthSlider.getValue() + "%");
            needRestart = true;
        }
    });

    JPanel okCancelPanel = new JPanel();
    getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
    okCancelPanel.setLayout(new BorderLayout(0, 0));

    JButton btnOk = new JButton("OK");
    btnOk.setToolTipText("Apply these settings and close the window");
    okCancelPanel.add(btnOk, BorderLayout.WEST);
    btnOk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            applySettings();
            ConfigWindow.this.setVisible(false);
        }
    });

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Close the window without applying settings");
    okCancelPanel.add(btnCancel, BorderLayout.EAST);

    JLabel lblConfigpath = new JLabel(TRConfiguration.getConfigFilePath().getAbsolutePath());
    lblConfigpath.setIcon(null);
    lblConfigpath.setToolTipText("Default config file path");
    lblConfigpath.setHorizontalAlignment(SwingConstants.CENTER);
    lblConfigpath.setFont(new Font("Dialog", Font.BOLD, 6));
    okCancelPanel.add(lblConfigpath, BorderLayout.CENTER);
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            ConfigWindow.this.setVisible(false);
        }
    });
}

From source file:org.kontalk.view.ThreadDetails.java

ThreadDetails(final Component focusGainer, KonThread thread) {
    mThread = thread;/*from www .j  av  a2 s. c  o m*/

    GroupPanel groupPanel = new GroupPanel(View.GAP_BIG, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Edit Chat")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    // editable fields
    groupPanel.add(new WebLabel(Tr.tr("Subject:")));
    String subj = mThread.getSubject();
    mSubjectField = new WebTextField(subj, 22);
    mSubjectField.setInputPrompt(subj);
    mSubjectField.setHideInputPromptOnFocus(false);
    groupPanel.add(mSubjectField);
    groupPanel.add(new WebSeparator(true, true));

    final WebSlider colorSlider = new WebSlider(WebSlider.HORIZONTAL);

    groupPanel.add(new WebLabel(Tr.tr("Custom Background")));
    mColorOpt = new WebRadioButton(Tr.tr("Color:") + " ");
    Optional<Color> optBGColor = mThread.getViewSettings().getBGColor();
    mColorOpt.setSelected(optBGColor.isPresent());
    mColorOpt.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            colorSlider.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mColor = new WebButton();
    mColor.setMinimumHeight(25);
    Color oldColor = optBGColor.orElse(DEFAULT_BG);
    mColor.setBottomBgColor(oldColor);
    groupPanel.add(new GroupPanel(GroupingType.fillLast, mColorOpt, mColor));

    colorSlider.setMinimum(0);
    colorSlider.setMaximum(100);
    colorSlider.setPaintTicks(false);
    colorSlider.setPaintLabels(false);
    colorSlider.setEnabled(optBGColor.isPresent());
    final GradientData gradientData = GradientData.getDefaultValue();
    // TODO set location for color
    gradientData.getColor(0);
    colorSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            float v = colorSlider.getValue() / (float) 100;
            Color c = gradientData.getColorForLocation(v);
            mColor.setBottomBgColor(c);
            mColor.repaint();
        }
    });
    groupPanel.add(colorSlider);

    mImgOpt = new WebRadioButton(Tr.tr("Image:") + " ");
    String imgPath = mThread.getViewSettings().getImagePath();
    mImgOpt.setSelected(!imgPath.isEmpty());
    mImgOpt.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            mImgChooser.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mImgChooser.getChooseButton().setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mImgChooser = Utils.createImageChooser(!imgPath.isEmpty(), imgPath);
    groupPanel.add(new GroupPanel(GroupingType.fillLast, mImgOpt, mImgChooser));
    UnselectableButtonGroup.group(mColorOpt, mImgOpt);
    groupPanel.add(new WebSeparator());

    //        groupPanel.add(new WebLabel(Tr.tr("Participants:")));
    //        mParticipantsList = new WebCheckBoxList();
    //        mParticipantsList.setVisibleRowCount(10);
    //        for (User oneUser : UserList.getInstance().getAll()) {
    //            boolean selected = mThread.getUser().contains(oneUser);
    //            mParticipantsList.getCheckBoxListModel().addCheckBoxElement(
    //                    new UserElement(oneUser),
    //                    selected);
    //        }
    final WebButton saveButton = new WebButton(Tr.tr("Save"));
    //        mParticipantsList.getModel().addListDataListener(new ListDataListener() {
    //            @Override
    //            public void intervalAdded(ListDataEvent e) {
    //            }
    //            @Override
    //            public void intervalRemoved(ListDataEvent e) {
    //            }
    //            @Override
    //            public void contentsChanged(ListDataEvent e) {
    //                saveButton.setEnabled(!mParticipantsList.getCheckedValues().isEmpty());
    //            }
    //        });
    //
    //        groupPanel.add(new WebScrollPane(mParticipantsList));
    //        groupPanel.add(new WebSeparator(true, true));

    this.add(groupPanel, BorderLayout.CENTER);

    saveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //                if (mParticipantsList.getCheckedValues().size() > 1) {
            //                        String infoText = Tr.t/r("More than one receiver not supported (yet).");
            //                        WebOptionPane.showMessageDialog(ThreadListView.this,
            //                                infoText,
            //                                Tr.t/r("Sorry"),
            //                                WebOptionPane.INFORMATION_MESSAGE);
            //                    return;
            //                }
            ThreadDetails.this.save();

            // close popup
            focusGainer.requestFocus();
        }
    });
    //this.getRootPane().setDefaultButton(saveButton);

    GroupPanel buttonPanel = new GroupPanel(2, saveButton);
    buttonPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    this.add(buttonPanel, BorderLayout.SOUTH);
}

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) {//www . ja  va  2s  .co 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.n52.ifgicopter.spf.input.FakeInputPlugin.java

/**
 * //w  w w.  j a  va  2 s .  c o m
 * @return
 */
private JPanel makeControlPanel() {
    if (this.controlPanel == null) {
        this.controlPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

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

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        start();
                    }
                });
            }
        });
        this.controlPanel.add(startButton);
        JButton stopButton = new JButton("Stop");
        stopButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        stop();
                    }
                });
            }
        });
        this.controlPanel.add(stopButton);

        JLabel sleepTimeLabel = new JLabel("Time between points in seconds:");
        this.controlPanel.add(sleepTimeLabel);
        double spinnerMin = 0.1d;
        double spinnerMax = 10000.0d;
        SpinnerModel model = new SpinnerNumberModel(DEFAULT_INTERVAL_MILLIS / SECONDS_TO_MILLISECONDS,
                spinnerMin, spinnerMax, 0.1d);
        JSpinner sleepTimeSpinner = new JSpinner(model);
        sleepTimeSpinner.setToolTipText("Select time using controls or manual input within the range of "
                + spinnerMin + " to " + spinnerMax + ".");

        sleepTimeSpinner.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                Object source = e.getSource();
                if (source instanceof JSpinner) {
                    final JSpinner spinner = (JSpinner) source;

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Double value = (Double) spinner.getValue();
                            value = Double.valueOf(value.doubleValue() * SECONDS_TO_MILLISECONDS);
                            FakeInputPlugin.this.sleepTimeMillis = value.longValue();
                        }
                    });
                } else
                    log.warn("Unsupported ChangeEvent, need JSpinner as source: " + e);
            }
        });
        // catch text change events without loosing the focus
        // JSpinner.DefaultEditor editor = (DefaultEditor) sleepTimeSpinner.getEditor();
        // not implemented, can be done using KeyEvent, but then it hast to be checked where in the text
        // field the keystroke was etc. --> too complicated.

        this.controlPanel.add(sleepTimeSpinner);
    }

    return this.controlPanel;
}

From source file:org.n52.ifgicopter.spf.input.GpxInputPlugin.java

/**
 * @return//from  ww  w.ja  va 2  s .co m
 * 
 */
private JPanel makeControlPanel() {
    if (this.controlPanel == null) {
        this.controlPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

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

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        start();
                    }
                });
            }
        });
        this.controlPanel.add(startButton);
        JButton stopButton = new JButton("Stop");
        stopButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        stop();
                    }
                });
            }
        });
        this.controlPanel.add(stopButton);
        JButton selectFileButton = new JButton("Select GPX File");
        selectFileButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                selectGpxFileAction();
            }
        });
        this.controlPanel.add(selectFileButton);

        JLabel sleepTimeLabel = new JLabel("Time between points in seconds:");
        this.controlPanel.add(sleepTimeLabel);
        double spinnerMin = 0.5d;
        double spinnerMax = 10000.0d;
        SpinnerModel model = new SpinnerNumberModel(2.0d, spinnerMin, spinnerMax, 0.1d);
        JSpinner sleepTimeSpinner = new JSpinner(model);
        sleepTimeSpinner.setToolTipText("Select time using controls or manual input within the range of "
                + spinnerMin + " to " + spinnerMax + ".");

        sleepTimeSpinner.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                Object source = e.getSource();
                if (source instanceof JSpinner) {
                    final JSpinner spinner = (JSpinner) source;

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Double value = (Double) spinner.getValue();
                            value = Double.valueOf(value.doubleValue() * SECONDS_TO_MILLISECONDS);
                            setSleepTimeMillis(value.longValue());
                        }
                    });
                } else
                    getLog().warn("Unsupported ChangeEvent, need JSpinner as source: " + e);
            }
        });
        // catch text change events without loosing the focus
        // JSpinner.DefaultEditor editor = (DefaultEditor) sleepTimeSpinner.getEditor();
        // not implemented, can be done using KeyEvent, but then it hast to be checked where in the text
        // field the keystroke was etc. --> too complicated.

        this.controlPanel.add(sleepTimeSpinner);
    }

    return this.controlPanel;
}

From source file:org.n52.ifgicopter.spf.input.HistoryPostgisInputPlugin.java

/**
 * @return// w  w  w.j a  va  2 s.  c om
 * 
 */
@Override
protected JPanel makeControlPanel() {
    if (this.controlPanel == null) {
        this.controlPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

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

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        start();
                    }
                });
            }
        });
        this.controlPanel.add(startButton);
        JButton stopButton = new JButton("Stop");
        stopButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        stop();
                    }
                });
            }
        });
        this.controlPanel.add(stopButton);

        JLabel sleepTimeLabel = new JLabel("Time between points in seconds:");
        this.controlPanel.add(sleepTimeLabel);
        double spinnerMin = 0.1d;
        double spinnerMax = 10000.0d;
        SpinnerModel model = new SpinnerNumberModel(2.0d, spinnerMin, spinnerMax, 0.1d);
        JSpinner sleepTimeSpinner = new JSpinner(model);
        sleepTimeSpinner.setToolTipText("Select time using controls or manual input within the range of "
                + spinnerMin + " to " + spinnerMax + ".");
        sleepTimeSpinner.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                Object source = e.getSource();
                if (source instanceof JSpinner) {
                    final JSpinner spinner = (JSpinner) source;

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Double value = (Double) spinner.getValue();
                            value = Double.valueOf(value.doubleValue() * 1000d);
                            setSleepTimeMillis(value.longValue());
                        }
                    });
                } else
                    log.warn("Unsupported ChangeEvent, need JSpinner as source: " + e);
            }
        });
        // catch text change events without loosing the focus
        // JSpinner.DefaultEditor editor = (DefaultEditor) sleepTimeSpinner.getEditor();
        // not implemented, can be done using KeyEvent, but then it hast to be checked where in the text
        // field the keystroke was etc. --> too complicated.

        this.controlPanel.add(sleepTimeSpinner);

        JLabel whereLabel = new JLabel("Where clause: ");
        this.whereField = new JTextField(this.where);
        this.whereField.setPreferredSize(new Dimension(200, 20));
        this.whereField.setToolTipText("Insert a valid SQL 'WHERE' clause here.");
        this.whereButton = new JButton("Load data");
        this.whereButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        updateWhere();

                        loadAllData();
                    }
                });
            }
        });

        this.controlPanel.add(whereLabel);
        this.controlPanel.add(this.whereField);
        this.controlPanel.add(this.whereButton);
    }

    return this.controlPanel;
}

From source file:org.n52.ifgicopter.spf.input.LastDataPostgisInputPlugin.java

@Override
protected JPanel makeControlPanel() {
    if (this.controlPanel == null) {
        this.controlPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

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

            @Override/*from  w  w  w  . ja  v  a 2s  .  c o  m*/
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        start();
                    }
                });
            }
        });
        this.controlPanel.add(startButton);
        JButton stopButton = new JButton("Stop");
        stopButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        stop();
                    }
                });
            }
        });
        this.controlPanel.add(stopButton);

        JLabel minTimeLabel = new JLabel("Mimium time database queries in milliseconds:");
        this.controlPanel.add(minTimeLabel);
        SpinnerModel model = new SpinnerNumberModel(this.minimumMillisBetweenRequests, 10d, 3600000d, 10d);
        JSpinner sleepTimeSpinner = new JSpinner(model);
        sleepTimeSpinner.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                Object source = e.getSource();
                if (source instanceof JSpinner) {
                    final JSpinner spinner = (JSpinner) source;

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Double value = (Double) spinner.getValue();
                            value = Double.valueOf(value.doubleValue() * 1000d);
                            setMinimumMillisBetweenRequests(value.longValue());
                        }
                    });
                } else
                    log.warn("Unsupported ChangeEvent, need JSpinner as source: " + e);
            }
        });
        // catch text change events without loosing the focus
        // JSpinner.DefaultEditor editor = (DefaultEditor) sleepTimeSpinner.getEditor();
        // not implemented, can be done using KeyEvent, but then it hast to be checked where in the text
        // field the keystroke was etc. --> too complicated.

        this.controlPanel.add(sleepTimeSpinner);
    }

    return this.controlPanel;
}

From source file:org.nuclos.client.dbtransfer.DBTransferImport.java

private PanelWizardStep newStep3(final MainFrameTab ifrm) {
    final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate();
    final PanelWizardStep step = new PanelWizardStep(
            localeDelegate.getMessage("dbtransfer.import.step3.1", "System Parameter"),
            localeDelegate.getMessage("dbtransfer.import.step3.2",
                    "Bestimmen Sie die Parameter dieses Systems. Sie k\u00f6nnen w\u00e4hlen zwischen dem aktuellen Zustand und dem aus der Konfigurationsdatei importierten Zustand (default). Sollte keine der beiden Vorgaben stimmen, so k\u00f6nnen Sie auch einen anderen Wert setzen.")) {

        @Override/*from  w w w. j av a  2  s  .c o  m*/
        public void prepare() {
            setupParameterPanel(importTransferObject.getParameter());
        }

        @Override
        public void applyState() throws InvalidStateException {
            setSelectedIncomingParameter.clear();
            setSelectedCurrentParameter.clear();
            mapSelectedOtherParameter.clear();

            for (ParameterEditor pe : lstParameterEditors) {
                if (pe.isCurrentValue())
                    setSelectedCurrentParameter.add(pe.getName());
                if (pe.isIncomingValue())
                    setSelectedIncomingParameter.add(pe.getName());
                if (pe.isOtherValue())
                    mapSelectedOtherParameter.put(pe.getName(), pe.getValue());
            }
        }
    };
    step.setComplete(true);

    utils.initJPanel(step, new double[] { TableLayout.FILL },
            new double[] { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED });

    rbCurrentAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetParameterEditors(true);
        }
    });
    rbIncomingAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetParameterEditors(false);
        }
    });

    final JScrollPane scroll = new JScrollPane(jpnParameter);
    scroll.setPreferredSize(new Dimension(680, 250));
    scroll.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
    scroll.getVerticalScrollBar().setUnitIncrement(20);
    scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scroll.getViewport().addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            Dimension parameterPanelSize = new Dimension(scroll.getViewport().getWidth(),
                    jpnParameter.getPreferredSize().height);
            jpnParameter.setPreferredSize(parameterPanelSize);
        }
    });

    step.add(jpnParameterHeader, "0,0");
    step.add(scroll, "0,1");
    step.add(jpnParameterFooter, "0,2");

    return step;
}

From source file:org.nuclos.client.dbtransfer.DBTransferImport.java

private void setupParameterPanel(Collection<EntityObjectVO> incomingParameterVOs) {
    final String entity = NuclosEntity.PARAMETER.getEntityName();
    List<EntityObjectVO> currentParameterVOs = new ArrayList<EntityObjectVO>(
            CollectionUtils.transform(MasterDataDelegate.getInstance().getMasterData(entity),
                    DalSupportForMD.getTransformerToEntityObjectVO(entity)));
    int iCountNew = 0;
    int iCountDeleted = 0;
    int iCountValueChanged = 0;

    final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate();

    // find new parameter and existing
    List<ParameterComparison> allParameter = new ArrayList<ParameterComparison>();
    for (EntityObjectVO incomingParameterVO : incomingParameterVOs) {
        boolean blnParamFound = false;
        String sCurrentValue = null;
        for (EntityObjectVO currentParameterVO : currentParameterVOs) {
            if ((incomingParameterVO.getField("name", String.class))
                    .equals(currentParameterVO.getField("name", String.class))) {
                blnParamFound = true;//from w w  w  .  java2s. c o  m
                sCurrentValue = currentParameterVO.getField("value", String.class);
                break;
            }
        }
        if (!blnParamFound) {
            allParameter.add(new ParameterComparison(incomingParameterVO, true, false, null));
            iCountNew++;
        } else {
            ParameterComparison parameter = new ParameterComparison(incomingParameterVO, false, false,
                    sCurrentValue);
            allParameter.add(parameter);
            if (parameter.isValueChanged())
                iCountValueChanged++;
        }
    }

    // find deleted parameter
    for (EntityObjectVO currentParameterVO : currentParameterVOs) {
        boolean blnParamFound = false;
        for (EntityObjectVO incomingParamVO : incomingParameterVOs) {
            if ((incomingParamVO.getField("name", String.class))
                    .equals(currentParameterVO.getField("name", String.class))) {
                blnParamFound = true;
                break;
            }
        }
        if (!blnParamFound) {
            allParameter.add(new ParameterComparison(currentParameterVO, false, true,
                    currentParameterVO.getField("value", String.class)));
            iCountDeleted++;
        }
    }

    // sort parameter VOs
    List<ParameterComparison> allParameterSorted = new ArrayList<ParameterComparison>(allParameter);
    Collections.sort(allParameterSorted, new Comparator<ParameterComparison>() {
        @Override
        public int compare(ParameterComparison o1, ParameterComparison o2) {
            return StringUtils.emptyIfNull(o1.getField("name", String.class))
                    .compareTo(StringUtils.emptyIfNull(o2.getField("name", String.class)));
        }
    });

    jpnParameterHeader.removeAll();
    jpnParameterFooter.removeAll();

    // setup parameter scroll pane
    jpnParameter.removeAll();

    double[] rowContraints = new double[allParameterSorted.size()];
    for (int i = 0; i < allParameterSorted.size(); i++)
        rowContraints[i] = TableLayout.PREFERRED;
    final int iWidthBeginnigSpace = 3;
    final int iWidthSeparator = 6;
    final int iWidthRadioButton = 20;

    utils.initJPanel(jpnParameter, new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator,
            iWidthRadioButton, iWidthRadioButton, iWidthRadioButton, TableLayout.FILL }, rowContraints);

    int iWidthLabelSize = 0;

    int iRow = 0;
    lstParameterEditors.clear();
    for (ParameterComparison parameter : allParameterSorted) {
        final ParameterEditor pe = new ParameterEditor(parameter);

        // init last state
        if (setSelectedCurrentParameter.contains(pe.getName()))
            pe.setCurrentValue();
        if (setSelectedIncomingParameter.contains(pe.getName()))
            pe.setIncomingValue();
        if (mapSelectedOtherParameter.containsKey(pe.getName()))
            pe.setOtherValue(mapSelectedOtherParameter.get(pe.getName()));

        // add change listener to update the radio buttons in footer
        pe.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                updateParameterAllSelection();
            }
        });

        pe.addToStepContent(jpnParameter, iRow);
        lstParameterEditors.add(pe);

        if (pe.getLabelPrefferedSize().width > iWidthLabelSize)
            iWidthLabelSize = pe.getLabelPrefferedSize().width;
        iRow++;
    }
    updateParameterAllSelection();
    jpnParameter.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1));

    // setup parameter header   
    utils.initJPanel(jpnParameterHeader,
            new double[] { iWidthBeginnigSpace,
                    iWidthLabelSize + iWidthSeparator + (iWidthRadioButton / 2) + utils.TABLE_LAYOUT_H_GAP
                            + 1/*Border*/,
                    iWidthRadioButton, iWidthRadioButton, TableLayout.FILL },
            new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 4 });

    if (allParameterSorted.isEmpty()) {
        jpnParameterHeader.add(new JLabel(
                localeDelegate.getMessage("dbtransfer.import.parameterpanel.18", "Keine Parameter vorhanden.")),
                "1,2,4,2");
        return;
    }

    jpnParameterHeader.add(
            new JLabel(localeDelegate.getMessage("dbtransfer.import.parameterpanel.1", "Parameter")), "1,2");
    jpnParameterHeader.add(new JLabel(
            localeDelegate.getMessage("dbtransfer.import.parameterpanel.2", "aktuellen Zustand beibehalten")),
            "2,0,4,0");
    jpnParameterHeader.add(new JSeparator(JSeparator.VERTICAL), "2,1,2,3");
    jpnParameterHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.parameterpanel.3",
            "importierten Zustand \u00fcbernehmen")), "3,1,4,1");
    jpnParameterHeader.add(new JSeparator(JSeparator.VERTICAL), "3,2,3,3");
    jpnParameterHeader.add(
            new JLabel(localeDelegate.getMessage("dbtransfer.import.parameterpanel.4", "anderen Wert setzen")),
            "4,2");
    jpnParameterHeader.add(new JSeparator(JSeparator.VERTICAL), "4,3");

    // setup parameter footer      
    utils.initJPanel(jpnParameterFooter,
            new double[] { iWidthBeginnigSpace,
                    iWidthLabelSize + iWidthSeparator + utils.TABLE_LAYOUT_H_GAP + 1/*Border*/,
                    iWidthRadioButton, iWidthRadioButton, TableLayout.FILL, TableLayout.PREFERRED,
                    TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED },
            new double[] { TableLayout.PREFERRED });

    final JLabel lbCompare = new JLabel(
            localeDelegate.getMessage("dbtransfer.import.parameterpanel.5", "\u00c4nderungen") + ":");
    final JLabel lbCompareNew = new JLabel(iCountNew + "");
    final JLabel lbCompareDeleted = new JLabel(iCountDeleted + "");
    final JLabel lbCompareValueChanged = new JLabel(iCountValueChanged + "");

    lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW);
    lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED);
    lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED);

    lbCompare.setToolTipText(localeDelegate.getMessage("dbtransfer.import.parameterpanel.6",
            "Vergleich von Aktueller- und Importkonfiguration"));
    lbCompareNew.setToolTipText(ParameterEditor.COMPARE_DESCRIPTION_NEW);
    lbCompareDeleted.setToolTipText(ParameterEditor.COMPARE_DESCRIPTION_DELETED);
    lbCompareValueChanged.setToolTipText(ParameterEditor.COMPARE_DESCRIPTION_VALUE_CHANGED);

    jpnParameterFooter.add(new JLabel(
            localeDelegate.getMessage("dbtransfer.import.parameterpanel.7", "auf alle Parameter anwenden")),
            "1,0,r,c");
    jpnParameterFooter.add(rbCurrentAll, "2,0,l,c");
    jpnParameterFooter.add(rbIncomingAll, "3,0,l,c");
    jpnParameterFooter.add(lbCompare, "4,0,r,c");
    jpnParameterFooter.add(lbCompareNew, "5,0,r,c");
    jpnParameterFooter.add(lbCompareValueChanged, "6,0,r,c");
    jpnParameterFooter.add(lbCompareDeleted, "7,0,r,c");
}