-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChannelsOverview.java
217 lines (174 loc) · 5.91 KB
/
ChannelsOverview.java
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
import java.awt.Checkbox;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import jlib330.Data;
public class ChannelsOverview extends JPanel implements Observer {
JLabel bhzLb = new JLabel("BHZ : ");
JTextField bhzTf = new JTextField(15);
JLabel bhnLb = new JLabel("BHN : ");
JTextField bhnTf = new JTextField(15);
JLabel bheLb = new JLabel("BHE : ");
JTextField bheTf = new JTextField(15);
JLabel hhzLb = new JLabel("HHZ : ");
JTextField hhzTf = new JTextField(15);
JCheckBox hhzCb = new JCheckBox();
JLabel hhnLb = new JLabel("HHN : ");
JTextField hhnTf = new JTextField(15);
JCheckBox hhnCb = new JCheckBox();
JLabel hheLb = new JLabel("HHE : ");
JTextField hheTf = new JTextField(15);
JCheckBox hheCb = new JCheckBox();
JLabel bmzLb = new JLabel("BMZ : ");
JTextField bmzTf = new JTextField(15);
JCheckBox bmzCb = new JCheckBox();
JLabel bmnLb = new JLabel("BMN : ");
JTextField bmnTf = new JTextField(15);
JCheckBox bmnCb = new JCheckBox();
JLabel bmeLb = new JLabel("BME : ");
JTextField bmeTf = new JTextField(15);
JCheckBox bmeCb = new JCheckBox();
JButton clearAllBtn = new JButton("Clear All Buffers");
Data bufs = null;
ChannelsOverview(Data buffers) {
this.bufs = buffers;
this.setLayout(new GridBagLayout());
bhzTf.setEditable(false);
bhnTf.setEditable(false);
bheTf.setEditable(false);
hhzTf.setEditable(false);
hhnTf.setEditable(false);
hheTf.setEditable(false);
bmzTf.setEditable(false);
bmnTf.setEditable(false);
bmeTf.setEditable(false);
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
this.add(bhzLb, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
this.add(bhzTf, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
this.add(bhnLb, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
this.add(bhnTf, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
this.add(bheLb, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
this.add(bheTf, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
this.add(hhzLb, gbc);
gbc.gridx = 1;
gbc.gridy = 3;
this.add(hhzTf, gbc);
gbc.gridx = 2;
gbc.gridy = 3;
this.add(hhzCb, gbc);
gbc.gridx = 0;
gbc.gridy = 4;
this.add(hhnLb, gbc);
gbc.gridx = 1;
gbc.gridy = 4;
this.add(hhnTf, gbc);
gbc.gridx = 2;
gbc.gridy = 4;
this.add(hhnCb, gbc);
gbc.gridx = 0;
gbc.gridy = 5;
this.add(hheLb, gbc);
gbc.gridx = 1;
gbc.gridy = 5;
this.add(hheTf, gbc);
gbc.gridx = 2;
gbc.gridy = 5;
this.add(hheCb, gbc);
gbc.gridx = 0;
gbc.gridy = 6;
this.add(bmzLb, gbc);
gbc.gridx = 1;
gbc.gridy = 6;
this.add(bmzTf, gbc);
gbc.gridx = 2;
gbc.gridy = 6;
this.add(bmzCb, gbc);
gbc.gridx = 0;
gbc.gridy = 7;
this.add(bmnLb, gbc);
gbc.gridx = 1;
gbc.gridy = 7;
this.add(bmnTf, gbc);
gbc.gridx = 2;
gbc.gridy = 7;
this.add(bmnCb, gbc);
gbc.gridx = 0;
gbc.gridy = 8;
this.add(bmeLb, gbc);
gbc.gridx = 1;
gbc.gridy = 8;
this.add(bmeTf, gbc);
gbc.gridx = 2;
gbc.gridy = 8;
this.add(bmeCb, gbc);
gbc.gridx = 1;
gbc.gridy = 10;
//gbc.weightx = 1.0;
//gbc.gridwidth = 2;
//gbc.fill = GridBagConstraints.HORIZONTAL;
this.add(clearAllBtn, gbc);
//gbc.fill = GridBagConstraints.NONE;
this.hhzCb.setSelected(true);
this.hhzCb.setActionCommand("hhzCb");
this.hhnCb.setSelected(true);
this.hhnCb.setActionCommand("hhnCb");
this.hheCb.setSelected(true);
this.hheCb.setActionCommand("hheCb");
this.bmzCb.setSelected(true);
this.bmzCb.setActionCommand("bmzCb");
this.bmnCb.setSelected(true);
this.bmnCb.setActionCommand("bmnCb");
this.bmeCb.setSelected(true);
this.bmeCb.setActionCommand("bmeCb");
}
public void update(Observable arg0, Object arg1) {
this.bhzTf.setText(Integer.toString(this.bufs.bhz.index));
this.bhnTf.setText(Integer.toString(this.bufs.bhn.index));
this.bheTf.setText(Integer.toString(this.bufs.bhe.index));
this.hhzTf.setText(Integer.toString(this.bufs.hhz.index));
this.hhnTf.setText(Integer.toString(this.bufs.hhn.index));
this.hheTf.setText(Integer.toString(this.bufs.hhe.index));
this.bmzTf.setText(Integer.toString(this.bufs.bmz.index));
this.bmnTf.setText(Integer.toString(this.bufs.bmn.index));
this.bmeTf.setText(Integer.toString(this.bufs.bme.index));
}
public void addChannelOverviewListener(ActionListener mal) {
this.clearAllBtn.addActionListener(mal);
this.hhzCb.addActionListener(mal);
this.hhnCb.addActionListener(mal);
this.hheCb.addActionListener(mal);
this.bmzCb.addActionListener(mal);
this.bmnCb.addActionListener(mal);
this.bmeCb.addActionListener(mal);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
Data buffers = new Data();
frame.add(new ChannelsOverview(buffers));
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}