ProSettingsGUI.ProSettingsPanel.java Source code

Java tutorial

Introduction

Here is the source code for ProSettingsGUI.ProSettingsPanel.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ProSettingsGUI;

import com.github.dougkelly88.FLIMPlateReaderGUI.GeneralClasses.Arduino;
import com.github.dougkelly88.FLIMPlateReaderGUI.GeneralClasses.Variable;
import com.github.dougkelly88.FLIMPlateReaderGUI.GeneralGUIComponents.HCAFLIMPluginFrame;
import com.github.dougkelly88.FLIMPlateReaderGUI.SequencingClasses.GUIComponents.XYSequencing;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Hashtable;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Frederik
 */
public class ProSettingsPanel extends javax.swing.JPanel {
    public static String eMail;

    private HCAFLIMPluginFrame parent_;
    private Variable var_;
    private Arduino arduino_;
    private XYSequencing xYSeq_;
    private double H_shift_scale;
    private double V_shift_scale;
    private boolean HV_swap;
    private Gson gson;
    private Writer writer;
    private FileInputStream objectiveFileInputStream;
    private JsonReader reader;
    private Hashtable<String, Objective> objectiveTable;
    private List<Objective> currentObjectiveArray;

    /**
     * Creates new form ProSettingsGUI
     */

    public ProSettingsPanel() {
        initComponents();
        var_ = Variable.getInstance();
        arduino_ = Arduino.getInstance();
        xYSeq_ = XYSequencing.getInstance();
        var_.motorizedMicroscopeTabelWhich = motorizedMicroscopeTableComboBox.getSelectedItem().toString();
        var_.autofocusWhich = AutoFocusSelectComboBox.getSelectedItem().toString();
        var_.acquisitionStrategy = AcquisitionStrategyComboBox.getSelectedItem().toString();
        H_shift_scale = 1;
        V_shift_scale = 1;
        eMail = "flimplatereader@gmail.com";
        HV_swap = false;
        gson = new GsonBuilder().create();
        // Fill up our objective table...
        //currentObjectiveArray = new List<Objective>();
        //        try{          
        //            objectiveFileInputStream = new FileInputStream("C:\\Program Files\\Micro-Manager-1.4.20\\ObjectiveOffsets\\Output.json");
        //            currentObjectiveArray = readObjectiveJson(objectiveFileInputStream);
        //        } catch(Exception ex) {
        //            System.out.println("oops");
        //            System.out.println(ex);
        //        }

        //        Integer turretPositions = currentObjectiveArray.size();
        //        objectiveTable = new Hashtable<String, Objective>();
        //        objectiveTable.clear();
        //        for(Integer i=0;i<turretPositions;i++){
        //            String key = "Turretposition_"+i.toString();
        //            JSONview.setText(key);
        //            objectiveTable.put(key, currentObjectiveArray.get(i));
        //        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        arduinoPanel = new javax.swing.JPanel();
        thresholdA0Field = new javax.swing.JTextField();
        thresholdA1Field = new javax.swing.JTextField();
        thresholdA0Label = new javax.swing.JLabel();
        thresholdA1Label = new javax.swing.JLabel();
        laserIntensityField = new javax.swing.JTextField();
        laserIntensityLabel = new javax.swing.JLabel();
        updateLaserIntensityButton = new javax.swing.JButton();
        shutterResponseLabel = new javax.swing.JLabel();
        shutterResponseField = new javax.swing.JTextField();
        enableLightCheckButton = new javax.swing.JRadioButton();
        warningPanel = new javax.swing.JPanel();
        importantInfo = new javax.swing.JScrollPane();
        warningTextArea = new javax.swing.JTextArea();
        fOVPanel = new javax.swing.JPanel();
        xOffsetRingField = new javax.swing.JTextField();
        xOffsetRingLabel = new javax.swing.JLabel();
        yOffsetRingField = new javax.swing.JTextField();
        yOffsetRingLabel = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        relayText = new javax.swing.JLabel();
        relayField = new javax.swing.JTextField();
        dougPanel = new javax.swing.JPanel();
        unknownFolderCheckBox = new javax.swing.JCheckBox();
        AcquisitionSavingMode_combo = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        Hardware = new javax.swing.JPanel();
        AutoFocusSelectComboBox = new javax.swing.JComboBox();
        AutoFocusLabel = new javax.swing.JLabel();
        motorizedMicroscopeTableComboBox = new javax.swing.JComboBox();
        MotorizedMicroscopeTableLabel = new javax.swing.JLabel();
        acquisitionStrategyPanel = new javax.swing.JPanel();
        AcquisitionStrategyComboBox = new javax.swing.JComboBox();
        prefindthreshtest = new javax.swing.JTextField();
        Text_for_prefind_thresh = new javax.swing.JTextField();
        percentage_coverage = new javax.swing.JTextField();
        pct_coverage_text = new javax.swing.JTextField();
        HShiftScale = new javax.swing.JTextField();
        VShiftScale = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        H_V_swap = new javax.swing.JToggleButton();
        JSONtest = new javax.swing.JButton();
        JSONview = new javax.swing.JTextField();
        readJSON = new javax.swing.JButton();
        forceAFdefault = new javax.swing.JButton();
        eMailAddressLabel = new javax.swing.JLabel();
        eMailAddressField = new javax.swing.JTextField();
        eMailDefault = new javax.swing.JLabel();
        UpdateEmailButton = new javax.swing.JButton();
        SpecialAcquistionTickBox = new javax.swing.JCheckBox();

        arduinoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Arduino"));

        thresholdA0Field.setText("0.5");

        thresholdA1Field.setText("0.5");

        thresholdA0Label.setText("Threshold for photodiode A0 (0-3.3V)");

        thresholdA1Label.setText("Threshold for photodiode A1 (0-3.3V)");

        laserIntensityField.setText("0");

        laserIntensityLabel.setText("Laser intensity");

        updateLaserIntensityButton.setText("Update");
        updateLaserIntensityButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateLaserIntensityButtonActionPerformed(evt);
            }
        });

        shutterResponseLabel.setText("Time between shutter and snapFlimImage");

        shutterResponseField.setText("0");

        enableLightCheckButton.setText("Enable light check (make sure HRI is turned off)");
        enableLightCheckButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                enableLightCheckButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout arduinoPanelLayout = new javax.swing.GroupLayout(arduinoPanel);
        arduinoPanel.setLayout(arduinoPanelLayout);
        arduinoPanelLayout
                .setHorizontalGroup(arduinoPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(arduinoPanelLayout
                                .createSequentialGroup().addGroup(arduinoPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(thresholdA0Field, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
                                        .addComponent(thresholdA1Field).addComponent(laserIntensityField)
                                        .addComponent(shutterResponseField,
                                                javax.swing.GroupLayout.Alignment.LEADING))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(arduinoPanelLayout.createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING).addComponent(laserIntensityLabel,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(arduinoPanelLayout.createSequentialGroup().addGroup(
                                                arduinoPanelLayout.createParallelGroup(
                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(arduinoPanelLayout.createSequentialGroup()
                                                                .addGroup(arduinoPanelLayout.createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                        .addComponent(thresholdA1Label)
                                                                        .addComponent(
                                                                                thresholdA0Label,
                                                                                javax.swing.GroupLayout.Alignment.TRAILING))
                                                                .addPreferredGap(
                                                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                .addComponent(updateLaserIntensityButton))
                                                        .addComponent(shutterResponseLabel))
                                                .addGap(0, 0, Short.MAX_VALUE))))
                        .addGroup(arduinoPanelLayout.createSequentialGroup().addComponent(enableLightCheckButton)
                                .addGap(0, 0, Short.MAX_VALUE)));
        arduinoPanelLayout.setVerticalGroup(arduinoPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(arduinoPanelLayout.createSequentialGroup().addGroup(arduinoPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(thresholdA0Field, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(thresholdA0Label).addComponent(updateLaserIntensityButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(arduinoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(thresholdA1Field, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(thresholdA1Label))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(arduinoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(laserIntensityField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(laserIntensityLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(arduinoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(shutterResponseLabel).addComponent(shutterResponseField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(enableLightCheckButton).addContainerGap(12, Short.MAX_VALUE)));

        warningPanel.setBackground(new java.awt.Color(255, 0, 51));
        warningPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Important Inforamtion"));

        warningTextArea.setEditable(false);
        warningTextArea.setBackground(new java.awt.Color(255, 0, 51));
        warningTextArea.setColumns(20);
        warningTextArea.setFont(new java.awt.Font("Monospaced", 0, 24)); // NOI18N
        warningTextArea.setRows(5);
        warningTextArea.setText(
                "Don't change anything on this page! \nChanging these values can damage the HRI \nand/or changes the behavior of the setup,\nso it might not work anymore.");
        warningTextArea.setBorder(null);
        importantInfo.setViewportView(warningTextArea);

        javax.swing.GroupLayout warningPanelLayout = new javax.swing.GroupLayout(warningPanel);
        warningPanel.setLayout(warningPanelLayout);
        warningPanelLayout.setHorizontalGroup(warningPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(warningPanelLayout.createSequentialGroup().addComponent(importantInfo,
                        javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)));
        warningPanelLayout.setVerticalGroup(warningPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, warningPanelLayout.createSequentialGroup()
                        .addComponent(importantInfo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)));

        fOVPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("FOV"));

        xOffsetRingField.setText("0");
        xOffsetRingField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                xOffsetRingFieldActionPerformed(evt);
            }
        });

        xOffsetRingLabel.setText("xOffset for centration of ring acquisition");

        yOffsetRingField.setText("0");
        yOffsetRingField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                yOffsetRingFieldActionPerformed(evt);
            }
        });

        yOffsetRingLabel.setText("yOffset for centration of ring acquisition");

        jButton1.setText("Check");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        relayText.setText("relay between HRI and camera");

        relayField.setText("0.7");
        relayField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                relayFieldActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout fOVPanelLayout = new javax.swing.GroupLayout(fOVPanel);
        fOVPanel.setLayout(fOVPanelLayout);
        fOVPanelLayout.setHorizontalGroup(fOVPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(fOVPanelLayout.createSequentialGroup().addContainerGap()
                        .addGroup(fOVPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(fOVPanelLayout.createSequentialGroup().addGroup(fOVPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(xOffsetRingField, javax.swing.GroupLayout.DEFAULT_SIZE, 70,
                                                Short.MAX_VALUE)
                                        .addComponent(yOffsetRingField))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(fOVPanelLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(xOffsetRingLabel).addComponent(yOffsetRingLabel))
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(fOVPanelLayout.createSequentialGroup().addComponent(jButton1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(relayField, javax.swing.GroupLayout.PREFERRED_SIZE, 35,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(relayText).addGap(94, 94, 94)))));
        fOVPanelLayout.setVerticalGroup(fOVPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(fOVPanelLayout.createSequentialGroup().addGroup(fOVPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jButton1)
                        .addComponent(relayText).addComponent(relayField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(fOVPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(xOffsetRingField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(xOffsetRingLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(fOVPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(yOffsetRingField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(yOffsetRingLabel))
                        .addContainerGap(23, Short.MAX_VALUE)));

        dougPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Doug Magic"));

        unknownFolderCheckBox.setText("Disable \"Unknown\" folder");
        unknownFolderCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                unknownFolderCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout dougPanelLayout = new javax.swing.GroupLayout(dougPanel);
        dougPanel.setLayout(dougPanelLayout);
        dougPanelLayout
                .setHorizontalGroup(dougPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(dougPanelLayout.createSequentialGroup().addContainerGap()
                                .addComponent(unknownFolderCheckBox)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        dougPanelLayout
                .setVerticalGroup(dougPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(dougPanelLayout.createSequentialGroup().addContainerGap()
                                .addComponent(unknownFolderCheckBox)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        AcquisitionSavingMode_combo
                .setModel(new javax.swing.DefaultComboBoxModel(new String[] { "separate OME.tiff for every FOV",
                        "single SWP OME.tiff", "single SWP OME.tiff with per FOV backup" }));
        AcquisitionSavingMode_combo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AcquisitionSavingMode_comboActionPerformed(evt);
            }
        });

        jLabel1.setText("Acquisition saving mode");

        Hardware.setBorder(javax.swing.BorderFactory.createTitledBorder("Hardware"));

        AutoFocusSelectComboBox.setModel(
                new javax.swing.DefaultComboBoxModel(new String[] { "ZDC Olympus", "Definite focus Zeiss" }));
        AutoFocusSelectComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AutoFocusSelectComboBoxActionPerformed(evt);
            }
        });

        AutoFocusLabel.setText("Auto focus");

        motorizedMicroscopeTableComboBox.setModel(
                new javax.swing.DefaultComboBoxModel(new String[] { "Corvus Stage", "WS PiezoDrive 08" }));
        motorizedMicroscopeTableComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                motorizedMicroscopeTableComboBoxActionPerformed(evt);
            }
        });

        MotorizedMicroscopeTableLabel.setText("Motorized microscope table");

        javax.swing.GroupLayout HardwareLayout = new javax.swing.GroupLayout(Hardware);
        Hardware.setLayout(HardwareLayout);
        HardwareLayout.setHorizontalGroup(HardwareLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(HardwareLayout.createSequentialGroup().addContainerGap()
                        .addGroup(HardwareLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(AutoFocusLabel).addComponent(MotorizedMicroscopeTableLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(HardwareLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(motorizedMicroscopeTableComboBox,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 169,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(AutoFocusSelectComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 169,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        HardwareLayout.setVerticalGroup(HardwareLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(HardwareLayout.createSequentialGroup()
                        .addGroup(HardwareLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(AutoFocusSelectComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(AutoFocusLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(HardwareLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(motorizedMicroscopeTableComboBox,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(MotorizedMicroscopeTableLabel))
                        .addContainerGap()));

        acquisitionStrategyPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Acquisition Strategy"));

        AcquisitionStrategyComboBox.setModel(new javax.swing.DefaultComboBoxModel(
                new String[] { "Start always by column 1 (horizontal fast axis)",
                        "Start always by row 1 (vertical fast axis) NOT IMPLEMENTED",
                        "Snake (horizontal fast axis)", "Snake (vertical fast axis) NOT IMPLEMENTED" }));
        AcquisitionStrategyComboBox.setSelectedItem(AcquisitionStrategyComboBox);
        AcquisitionStrategyComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AcquisitionStrategyComboBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout acquisitionStrategyPanelLayout = new javax.swing.GroupLayout(
                acquisitionStrategyPanel);
        acquisitionStrategyPanel.setLayout(acquisitionStrategyPanelLayout);
        acquisitionStrategyPanelLayout.setHorizontalGroup(
                acquisitionStrategyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(acquisitionStrategyPanelLayout
                                .createSequentialGroup().addContainerGap().addComponent(AcquisitionStrategyComboBox,
                                        0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addContainerGap()));
        acquisitionStrategyPanelLayout.setVerticalGroup(
                acquisitionStrategyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(AcquisitionStrategyComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE));

        prefindthreshtest.setText("210");
        prefindthreshtest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prefindthreshtestActionPerformed(evt);
            }
        });

        Text_for_prefind_thresh.setEditable(false);
        Text_for_prefind_thresh.setText("Threshold for prefind");
        Text_for_prefind_thresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Text_for_prefind_threshActionPerformed(evt);
            }
        });

        percentage_coverage.setText("0.5");

        pct_coverage_text.setText("% coverage needed");

        HShiftScale.setText("1");
        HShiftScale.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                HShiftScaleActionPerformed(evt);
            }
        });

        VShiftScale.setText("-1");
        VShiftScale.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                VShiftScaleActionPerformed(evt);
            }
        });

        jLabel2.setText("H shift scaling");

        jLabel3.setText("V shift scaling");

        H_V_swap.setSelected(true);
        H_V_swap.setText("H/V swap");
        H_V_swap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                H_V_swapActionPerformed(evt);
            }
        });

        JSONtest.setText("Test JSON");
        JSONtest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSONtestActionPerformed(evt);
            }
        });

        JSONview.setText("TEST INIT");
        JSONview.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSONviewActionPerformed(evt);
            }
        });

        readJSON.setText("Read JSON");

        forceAFdefault.setText("Set AF default");
        forceAFdefault.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                forceAFdefaultActionPerformed(evt);
            }
        });

        eMailAddressLabel.setText("Email address:");

        eMailAddressField.setText("flimplatereader@gmail.com");
        eMailAddressField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eMailAddressFieldActionPerformed(evt);
            }
        });

        eMailDefault.setText("Default: flimplatereader@gmail.com / PW:flimimages");

        UpdateEmailButton.setText("Update Email");
        UpdateEmailButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                UpdateEmailButtonActionPerformed(evt);
            }
        });

        SpecialAcquistionTickBox.setText(
                "Special Acquisition (Row A with filtercombination 1, Row B with filtercombination 2, ...):");
        SpecialAcquistionTickBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SpecialAcquistionTickBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(warningPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(Hardware, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(dougPanel, javax.swing.GroupLayout.Alignment.LEADING,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                .addComponent(fOVPanel, javax.swing.GroupLayout.Alignment.LEADING,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                .addComponent(arduinoPanel, javax.swing.GroupLayout.Alignment.LEADING,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addGap(50, 50, 50).addGroup(layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(prefindthreshtest,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                                                .addComponent(percentage_coverage).addComponent(HShiftScale)
                                                .addComponent(VShiftScale))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING,
                                                                        false)
                                                                .addComponent(Text_for_prefind_thresh,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 122,
                                                                        Short.MAX_VALUE)
                                                                .addComponent(pct_coverage_text))
                                                        .addComponent(jLabel2).addComponent(jLabel3)))
                                        .addGroup(layout.createSequentialGroup().addComponent(H_V_swap)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(forceAFdefault)))
                                        .addGap(0, 12, Short.MAX_VALUE))
                                .addGroup(layout.createSequentialGroup().addGap(18, 18, 18).addGroup(layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addGroup(layout.createSequentialGroup().addComponent(JSONtest)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(readJSON))
                                        .addComponent(JSONview, javax.swing.GroupLayout.PREFERRED_SIZE, 206,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addContainerGap(22, Short.MAX_VALUE))))
                .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(acquisitionStrategyPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                        .addComponent(AcquisitionSavingMode_combo,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 206,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 149,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup().addComponent(eMailAddressLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(eMailAddressField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(UpdateEmailButton))
                                .addComponent(eMailDefault).addComponent(SpecialAcquistionTickBox))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                        .addComponent(warningPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(arduinoPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(JSONtest).addComponent(readJSON))
                                        .addGap(18, 18, 18).addComponent(JSONview,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 92,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(8, 8, 8)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                        .addComponent(fOVPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(dougPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(3, 3, 3)
                                        .addComponent(Hardware, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(AcquisitionSavingMode_combo,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel1))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(acquisitionStrategyPanel,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(H_V_swap).addComponent(forceAFdefault))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(prefindthreshtest,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(Text_for_prefind_thresh,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(percentage_coverage,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(pct_coverage_text,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(HShiftScale, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel2))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(VShiftScale, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel3))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(eMailAddressLabel)
                                .addComponent(eMailAddressField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(UpdateEmailButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(eMailDefault)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(SpecialAcquistionTickBox).addContainerGap(100, Short.MAX_VALUE)));
    }// </editor-fold>//GEN-END:initComponents

    public void setParent(Object o) {
        parent_ = (HCAFLIMPluginFrame) o;
    }

    private void updateLaserIntensityButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateLaserIntensityButtonActionPerformed
        double intensity = arduino_.getLaserIntensity();
        intensity = Math.round(100.0 * intensity) / 100.0;
        String intensityy = Double.toString(intensity);
        laserIntensityField.setText(intensityy);
        var_.th2 = Double.parseDouble(thresholdA1Field.getText());
        var_.th1 = Double.parseDouble(thresholdA0Field.getText());
        var_.shutterResponse = Integer.parseInt(shutterResponseField.getText());
    }//GEN-LAST:event_updateLaserIntensityButtonActionPerformed

    private void enableLightCheckButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableLightCheckButtonActionPerformed
        if (enableLightCheckButton.isSelected()) {
            var_.safetyOff = true;
        } else {
            var_.safetyOff = false;
        }
    }//GEN-LAST:event_enableLightCheckButtonActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        String test = xOffsetRingField.getText();
        System.out.println(test);
        //   int xOff;
        //  xOff= new Integer(xOffsetRingField.getText());
        double xOffsetRing = Double.parseDouble(xOffsetRingField.getText());
        System.out.println(xOffsetRing);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void xOffsetRingFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_xOffsetRingFieldActionPerformed
        double xOffsetRing = Double.parseDouble(xOffsetRingField.getText());
        var_.xOffset = xOffsetRing;
    }//GEN-LAST:event_xOffsetRingFieldActionPerformed

    private void yOffsetRingFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yOffsetRingFieldActionPerformed
        double yOffsetRing = Double.parseDouble(yOffsetRingField.getText());
        var_.yOffset = yOffsetRing;
    }//GEN-LAST:event_yOffsetRingFieldActionPerformed

    private void unknownFolderCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unknownFolderCheckBoxActionPerformed
        if (unknownFolderCheckBox.isSelected()) {
            var_.check2 = true;
        } else {
            var_.check2 = false;
        }
    }//GEN-LAST:event_unknownFolderCheckBoxActionPerformed

    private void AcquisitionSavingMode_comboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AcquisitionSavingMode_comboActionPerformed
        var_.AcquisitionSavingMode = AcquisitionSavingMode_combo.getSelectedItem().toString();
    }//GEN-LAST:event_AcquisitionSavingMode_comboActionPerformed

    private void AutoFocusSelectComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AutoFocusSelectComboBoxActionPerformed
        var_.autofocusWhich = AutoFocusSelectComboBox.getSelectedItem().toString();
    }//GEN-LAST:event_AutoFocusSelectComboBoxActionPerformed

    private void motorizedMicroscopeTableComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_motorizedMicroscopeTableComboBoxActionPerformed
        var_.motorizedMicroscopeTabelWhich = motorizedMicroscopeTableComboBox.getSelectedItem().toString();
    }//GEN-LAST:event_motorizedMicroscopeTableComboBoxActionPerformed

    private void AcquisitionStrategyComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AcquisitionStrategyComboBoxActionPerformed
        var_.acquisitionStrategy = AcquisitionStrategyComboBox.getSelectedItem().toString();
    }//GEN-LAST:event_AcquisitionStrategyComboBoxActionPerformed

    private void prefindthreshtestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prefindthreshtestActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_prefindthreshtestActionPerformed

    public double getPrefindThresh() {
        return Double.parseDouble(this.prefindthreshtest.getText());
    }

    private void Text_for_prefind_threshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Text_for_prefind_threshActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Text_for_prefind_threshActionPerformed

    public double getPercentCoverage() {
        return Double.parseDouble(this.percentage_coverage.getText());
    }

    private void relayFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relayFieldActionPerformed
        var_.relay = Double.parseDouble(relayField.getText());
    }//GEN-LAST:event_relayFieldActionPerformed

    private void HShiftScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_HShiftScaleActionPerformed
        // TODO add your handling code here:
        H_shift_scale = Double.parseDouble(HShiftScale.getText());
    }//GEN-LAST:event_HShiftScaleActionPerformed

    private void VShiftScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VShiftScaleActionPerformed
        // TODO add your handling code here:
        V_shift_scale = Double.parseDouble(VShiftScale.getText());
    }//GEN-LAST:event_VShiftScaleActionPerformed

    private void H_V_swapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_H_V_swapActionPerformed
        // TODO add your handling code here:
        HV_swap = H_V_swap.isSelected();
    }//GEN-LAST:event_H_V_swapActionPerformed

    private void JSONviewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JSONviewActionPerformed
        // TODO add your handling code here:

        JSONview.setText("HELLO");
    }//GEN-LAST:event_JSONviewActionPerformed

    private void JSONtestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JSONtestActionPerformed
        //        try{
        //            writer = new FileWriter("C:\\Program Files\\Micro-Manager-1.4.20\\ObjectiveOffsets\\Output.json");
        //        } catch (IOException ex) {         
        //        }        
        //        Objective [] Objectivearray = new Objective[6];
        //        for (int i=0;i<6;i++){
        //                Objectivearray[i] = new Objective("Turret_pos"+i,(i*10.0),(i*1.0),(i*2.0),(i*3.0));
        //        }
        //        gson.toJson(Objectivearray, writer);
        //        try{
        //            writer.close();
        //        } catch (IOException ex) {
        //        } finally {
        //        }
    }//GEN-LAST:event_JSONtestActionPerformed

    private void forceAFdefaultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forceAFdefaultActionPerformed
        // TODO add your handling code here:
        parent_.setAFdefaultheight(Double.parseDouble(parent_.xyzmi_.getZAbsolute().toString()));
    }//GEN-LAST:event_forceAFdefaultActionPerformed

    private void eMailAddressFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eMailAddressFieldActionPerformed

    }//GEN-LAST:event_eMailAddressFieldActionPerformed

    private void UpdateEmailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateEmailButtonActionPerformed
        eMail = eMailAddressField.getText();
        System.out.println("New Email address:" + eMail);
    }//GEN-LAST:event_UpdateEmailButtonActionPerformed

    private void SpecialAcquistionTickBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SpecialAcquistionTickBoxActionPerformed
        if (SpecialAcquistionTickBox.isSelected()) {
            var_.specialAcq = true;
        } else {
            var_.specialAcq = false;
        }
    }//GEN-LAST:event_SpecialAcquistionTickBoxActionPerformed

    public double getHshiftscale() {
        return H_shift_scale;
    }

    public double getVshiftscale() {
        return V_shift_scale;
    }

    public boolean getHVswap() {
        return HV_swap;
    }

    public void updatePanel() {
        // do something when ProSettingsPanel is selected
    }

    public List readObjectiveJson(InputStream in) throws IOException {
        reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
        try {
            return readObjectivesArray(reader);
        } finally {
            reader.close();
        }
    }

    public List readObjectivesArray(JsonReader reader) throws IOException {
        List Objectives = new ArrayList();
        reader.beginArray();
        while (reader.hasNext()) {
            Objectives.add(readObjectiveProperties(reader));
        }
        reader.endArray();
        return Objectives;
    }

    public Objective readObjectiveProperties(JsonReader reader) throws IOException {
        //initialise with some defaults
        String name = "NULL";
        Double magnification = 1.0;
        Double Xoffset = 0.0;
        Double Yoffset = 0.0;
        Double Zoffset = 0.0;

        reader.beginObject();
        while (reader.hasNext()) {
            String itemname = reader.nextName();
            if (itemname.equals("name")) {
                name = reader.nextString();
            } else if (itemname.equals("magnification")) {
                magnification = reader.nextDouble();
            } else if (itemname.equals("Xoffset")) {
                Xoffset = reader.nextDouble();
            } else if (itemname.equals("Yoffset")) {
                Yoffset = reader.nextDouble();
            } else if (itemname.equals("Zoffset")) {
                Zoffset = reader.nextDouble();
            } else {
                reader.skipValue();
            }
        }
        reader.endObject();
        return new Objective(name, magnification, Xoffset, Yoffset, Zoffset);
    }

    public class Objective {
        private String name;
        private Double magnification;
        private Double Xoffset;
        private Double Yoffset;
        private Double Zoffset;

        public Objective() {
            name = "Default";
            magnification = 1.0;
            Xoffset = 0.0;
            Yoffset = 0.0;
            Zoffset = 10.0;
        }

        public Objective(String namein, Double magnificationin, Double Xoffsetin, Double Yoffsetin,
                Double Zoffsetin) {
            name = namein;
            magnification = magnificationin;
            Xoffset = Xoffsetin;
            Yoffset = Yoffsetin;
            Zoffset = Zoffsetin;
        }

        public String getname() {
            return this.name;
        }

        public Double getmag() {
            return this.magnification;
        }

        public Double getXoffset() {
            return this.Xoffset;
        }

        public Double Yoffset() {
            return this.Yoffset;
        }

        public Double Zoffset() {
            return this.Zoffset;
        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox AcquisitionSavingMode_combo;
    private javax.swing.JComboBox AcquisitionStrategyComboBox;
    private javax.swing.JLabel AutoFocusLabel;
    private javax.swing.JComboBox AutoFocusSelectComboBox;
    private javax.swing.JTextField HShiftScale;
    private javax.swing.JToggleButton H_V_swap;
    private javax.swing.JPanel Hardware;
    private javax.swing.JButton JSONtest;
    private javax.swing.JTextField JSONview;
    private javax.swing.JLabel MotorizedMicroscopeTableLabel;
    private javax.swing.JCheckBox SpecialAcquistionTickBox;
    private javax.swing.JTextField Text_for_prefind_thresh;
    private javax.swing.JButton UpdateEmailButton;
    private javax.swing.JTextField VShiftScale;
    private javax.swing.JPanel acquisitionStrategyPanel;
    private javax.swing.JPanel arduinoPanel;
    private javax.swing.JPanel dougPanel;
    private javax.swing.JTextField eMailAddressField;
    private javax.swing.JLabel eMailAddressLabel;
    private javax.swing.JLabel eMailDefault;
    private javax.swing.JRadioButton enableLightCheckButton;
    private javax.swing.JPanel fOVPanel;
    private javax.swing.JButton forceAFdefault;
    private javax.swing.JScrollPane importantInfo;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField laserIntensityField;
    private javax.swing.JLabel laserIntensityLabel;
    private javax.swing.JComboBox motorizedMicroscopeTableComboBox;
    private javax.swing.JTextField pct_coverage_text;
    private javax.swing.JTextField percentage_coverage;
    private javax.swing.JTextField prefindthreshtest;
    private javax.swing.JButton readJSON;
    private javax.swing.JTextField relayField;
    private javax.swing.JLabel relayText;
    private javax.swing.JTextField shutterResponseField;
    private javax.swing.JLabel shutterResponseLabel;
    private javax.swing.JTextField thresholdA0Field;
    private javax.swing.JLabel thresholdA0Label;
    private javax.swing.JTextField thresholdA1Field;
    private javax.swing.JLabel thresholdA1Label;
    private javax.swing.JCheckBox unknownFolderCheckBox;
    private javax.swing.JButton updateLaserIntensityButton;
    private javax.swing.JPanel warningPanel;
    private javax.swing.JTextArea warningTextArea;
    private javax.swing.JTextField xOffsetRingField;
    private javax.swing.JLabel xOffsetRingLabel;
    private javax.swing.JTextField yOffsetRingField;
    private javax.swing.JLabel yOffsetRingLabel;
    // End of variables declaration//GEN-END:variables
}