Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeschamps committed Oct 15, 2020
1 parent bd2fc9a commit d35acfa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/de/embl/rieslab/htsmlm/PowerMeterPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -47,6 +49,7 @@ public class PowerMeterPanel extends ConfigurablePanel{
private int idle_, npos_;
private boolean monitoring_ = false;
private Processor monitorThread;
private int selectedWavelength_;

public static final String PROP_POWER = "Laser powermeter";

Expand All @@ -64,7 +67,15 @@ public PowerMeterPanel(String label) {
Font f = label_.getFont();
label_.setFont(f.deriveFont(f.getStyle() | Font.BOLD));

selectedWavelength_ = 0;
combobox_ = new JComboBox<String>(temp);
combobox_.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
if(e.getModifiers() == ActionEvent.MOUSE_EVENT_MASK) {
selectedWavelength_ = combobox_.getSelectedIndex();
}
}
});
togglebutton_ = new JToggleButton("Monitor");

panelGraph_ = new JPanel();
Expand Down Expand Up @@ -265,7 +276,7 @@ public boolean isMonitoring(){
}

protected int getCurrentWavelength() {
return combobox_.getSelectedIndex();
return selectedWavelength_;
}

protected double convertPower(double value) {
Expand Down

0 comments on commit d35acfa

Please sign in to comment.