OSPE_SlitDefaultAperturePanel.java
2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package osp.ui;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import osp.Mask;
public class OSPE_SlitDefaultAperturePanel extends JDialog {
private static final long serialVersionUID = 1L;
private OspeControl control;
BorderLayout borderLayout = new BorderLayout();
JTextField defApertureBox = new JTextField(3);
JButton jButtonOK = new JButton("OK");
JButton jButtonCancel = new JButton("Cancel");
Mask currentMask;
double dbVal;
double val=0.0;
public OSPE_SlitDefaultAperturePanel(OspeControl ctrl,Mask msk)
{
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setAlwaysOnTop(true);
setTitle("Slit Default Aperture");
control=ctrl;
currentMask = msk;
dbVal=currentMask.getDefaultSlitAperture();
val = dbVal;
String strDbVal = String.valueOf(dbVal);
defApertureBox.setText(strDbVal);
JPanel p1 = new JPanel();
JPanel p2 = new JPanel(new FlowLayout());
JPanel p3 = new JPanel(new FlowLayout(FlowLayout.CENTER));
p1.add(new JLabel("Actual default slit aperture : "+strDbVal));
p2.add(new JLabel("New default slit aperture value : "));
p2.add(defApertureBox);
p3.add(jButtonOK);
p3.add(jButtonCancel);
jButtonOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
val=Double.parseDouble(defApertureBox.getText());
currentMask.setDefaultSlitAperture(val);
currentMask.imagePater.update();
dispose();
}
});
jButtonCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
this.getContentPane().add(p1, BorderLayout.NORTH);
this.getContentPane().add(p2, BorderLayout.CENTER);
this.getContentPane().add(p3, BorderLayout.SOUTH);
pack();
setVisible(true);
}
}