This commit is contained in:
2015-12-02 08:44:11 +01:00
parent 8ab97fc8c7
commit d0c217d414
2 changed files with 162 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.Motor;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays;
import ch.psi.pshell.imaging.Pen;
@@ -53,6 +54,10 @@ public class Microscope extends Panel {
motorPanel2 = new ch.psi.pshell.swing.MotorPanel();
processVariablePanel2 = new ch.psi.pshell.swing.ProcessVariablePanel();
checkHighDef = new javax.swing.JCheckBox();
button0 = new javax.swing.JButton();
button90 = new javax.swing.JButton();
button180 = new javax.swing.JButton();
button270 = new javax.swing.JButton();
renderer.setAutoscrolls(true);
renderer.setDeviceName("mic-high");
@@ -62,14 +67,19 @@ public class Microscope extends Panel {
motorPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("cy"));
motorPanel1.setDecimals(2);
motorPanel1.setDeviceName("cy");
motorPanel1.setShowHoming(false);
motorPanel1.setShowJog(false);
motorPanel1.setShowStatus(false);
motorPanel1.setShowTitle(true);
processVariablePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("x"));
processVariablePanel1.setDecimals(2);
processVariablePanel1.setDeviceName("x");
processVariablePanel1.setShowLimitButtons(false);
processVariablePanel1.setShowSlider(false);
processVariablePanel1.setShowTitle(true);
processVariablePanel1.setStepIncrement(0.001);
processVariablePanel1.setStepSize(0.01);
buttonDefineBeam.setText("Define Beam");
buttonDefineBeam.addActionListener(new java.awt.event.ActionListener() {
@@ -81,14 +91,19 @@ public class Microscope extends Panel {
motorPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("cz"));
motorPanel2.setDecimals(2);
motorPanel2.setDeviceName("cz");
motorPanel2.setShowHoming(false);
motorPanel2.setShowJog(false);
motorPanel2.setShowStatus(false);
motorPanel2.setShowTitle(true);
processVariablePanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("omega"));
processVariablePanel2.setDecimals(2);
processVariablePanel2.setDeviceName("omega");
processVariablePanel2.setShowLimitButtons(false);
processVariablePanel2.setShowSlider(false);
processVariablePanel2.setShowTitle(true);
processVariablePanel2.setStepIncrement(10.0);
processVariablePanel2.setStepSize(90.0);
checkHighDef.setSelected(true);
checkHighDef.setText("High definition");
@@ -98,13 +113,41 @@ public class Microscope extends Panel {
}
});
button0.setText("0");
button0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button0ActionPerformed(evt);
}
});
button90.setText("90");
button90.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button90ActionPerformed(evt);
}
});
button180.setText("180");
button180.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button180ActionPerformed(evt);
}
});
button270.setText("270");
button270.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button270ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(123, 123, 123)
.addComponent(buttonDefineBeam))
@@ -117,12 +160,23 @@ public class Microscope extends Panel {
.addComponent(processVariablePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(checkHighDef)))
.addComponent(checkHighDef))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(button0)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button90)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button180)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button270)))
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {motorPanel1, motorPanel2, processVariablePanel1, processVariablePanel2});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {button0, button180, button270, button90});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@@ -136,7 +190,13 @@ public class Microscope extends Panel {
.addComponent(processVariablePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(processVariablePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(button0)
.addComponent(button90)
.addComponent(button180)
.addComponent(button270))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
.addComponent(checkHighDef)
.addGap(18, 18, 18)
.addComponent(buttonDefineBeam)
@@ -191,7 +251,43 @@ public class Microscope extends Panel {
renderer.setDeviceName(checkHighDef.isSelected() ? "mic-high" : "mic-low");
}//GEN-LAST:event_checkHighDefActionPerformed
private void button0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button0ActionPerformed
try{
((Motor)getDevice("omega")).moveAsync(0.0);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_button0ActionPerformed
private void button90ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button90ActionPerformed
try{
((Motor)getDevice("omega")).moveAsync(90.0);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_button90ActionPerformed
private void button180ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button180ActionPerformed
try{
((Motor)getDevice("omega")).moveAsync(180.0);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_button180ActionPerformed
private void button270ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button270ActionPerformed
try{
((Motor)getDevice("omega")).moveAsync(270.0);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_button270ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton button0;
private javax.swing.JButton button180;
private javax.swing.JButton button270;
private javax.swing.JButton button90;
private javax.swing.JButton buttonDefineBeam;
private javax.swing.JCheckBox checkHighDef;
private ch.psi.pshell.swing.MotorPanel motorPanel1;