提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.demo.frame; |
H |
2 |
|
|
3 |
import com.netsdk.common.FunctionList; |
|
4 |
import com.netsdk.common.Res; |
|
5 |
import com.netsdk.lib.NetSDKLib; |
|
6 |
import com.netsdk.lib.NetSDKLib.LLong; |
|
7 |
import com.netsdk.lib.ToolKits; |
|
8 |
import com.sun.jna.Memory; |
|
9 |
import com.sun.jna.Pointer; |
|
10 |
import com.sun.jna.ptr.IntByReference; |
|
11 |
import com.sun.jna.ptr.LongByReference; |
|
12 |
|
|
13 |
import javax.swing.*; |
|
14 |
import javax.swing.border.Border; |
|
15 |
import javax.swing.table.DefaultTableModel; |
|
16 |
import java.awt.*; |
|
17 |
import java.awt.event.ActionEvent; |
|
18 |
import java.awt.event.ActionListener; |
|
19 |
import java.awt.event.WindowAdapter; |
|
20 |
import java.awt.event.WindowEvent; |
|
21 |
import java.io.File; |
|
22 |
import java.io.UnsupportedEncodingException; |
|
23 |
|
|
24 |
import static com.netsdk.lib.NetSDKLib.NET_MAX_NAME_LEN; |
|
25 |
import static com.netsdk.lib.NetSDKLib.NET_MAX_PLATE_NUMBER_LEN; |
|
26 |
import static java.util.Locale.ENGLISH; |
|
27 |
|
|
28 |
class JNATrafficListFrame extends Frame{ |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
*/ |
|
33 |
private static final long serialVersionUID = 1L; |
|
34 |
static NetSDKLib NetSdk = NetSDKLib.NETSDK_INSTANCE; |
|
35 |
static NetSDKLib ConfigSdk = NetSDKLib.CONFIG_INSTANCE; |
|
36 |
|
|
37 |
//登陆参数 |
|
38 |
private String m_strIp = "172.13.138.22"; |
|
39 |
private Integer m_nPort = new Integer("37777"); |
|
40 |
private String m_strUser = "admin"; |
|
41 |
private String m_strPassword = "hzci202239"; |
|
42 |
private int nNo = 0; |
|
43 |
private String[] name = {Res.string().getSerialNumber(), Res.string().getLicensePlateNumber(), Res.string().getCarOwner(), |
|
44 |
Res.string().getStartTime(), Res.string().getEndTime(),Res.string().getOpenModel()}; |
|
45 |
|
|
46 |
//设备信息 |
|
47 |
private NetSDKLib.NET_DEVICEINFO_Ex m_stDeviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex(); // 对应CLIENT_LoginEx2 |
|
48 |
private LLong m_hLoginHandle = new LLong(0); //登陆句柄 |
|
49 |
private NetSDKLib.NET_TRAFFIC_LIST_RECORD pstRecordAdd = new NetSDKLib.NET_TRAFFIC_LIST_RECORD(); // 开闸权限 |
|
50 |
|
|
51 |
//////////////////SDK相关信息/////////////////////////// |
|
52 |
//NetSDK 库初始化 |
|
53 |
public class SDKEnvironment { |
|
54 |
|
|
55 |
private boolean bInit = false; |
|
56 |
private boolean bLogopen = false; |
|
57 |
|
|
58 |
private DisConnect disConnect = new DisConnect(); //设备断线通知回调 |
|
59 |
private HaveReConnect haveReConnect = new HaveReConnect(); //网络连接恢复 |
|
60 |
|
|
61 |
//设备断线回调: 通过 CLIENT_Init 设置该回调函数,当设备出现断线时,SDK会调用该函数 |
|
62 |
public class DisConnect implements NetSDKLib.fDisConnect { |
|
63 |
public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) { |
|
64 |
System.out.printf("Device[%s] Port[%d] DisConnect!\n", pchDVRIP, nDVRPort); |
|
65 |
} |
|
66 |
} |
|
67 |
//网络连接恢复,设备重连成功回调 |
|
68 |
// 通过 CLIENT_SetAutoReconnect 设置该回调函数,当已断线的设备重连成功时,SDK会调用该函数 |
|
69 |
public class HaveReConnect implements NetSDKLib.fHaveReConnect { |
|
70 |
public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) { |
|
71 |
System.out.printf("ReConnect Device[%s] Port[%d]\n", pchDVRIP, nDVRPort); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
//初始化 |
|
76 |
public boolean init() { |
|
77 |
bInit = NetSdk.CLIENT_Init(disConnect, null); |
|
78 |
if(!bInit) { |
|
79 |
System.out.println("Initialize SDK failed"); |
|
80 |
return false; |
|
81 |
} |
|
82 |
|
|
83 |
//打开日志,可选 |
|
84 |
NetSDKLib.LOG_SET_PRINT_INFO setLog = new NetSDKLib.LOG_SET_PRINT_INFO(); |
|
85 |
File path = new File("."); |
|
86 |
String logPath = path.getAbsoluteFile().getParent() + "\\sdk_log\\TrafficList" + System.currentTimeMillis() + ".log"; |
|
87 |
|
|
88 |
setLog.bSetFilePath = 1; |
|
89 |
System.arraycopy(logPath.getBytes(), 0, setLog.szLogFilePath, 0, logPath.getBytes().length); |
|
90 |
|
|
91 |
setLog.bSetPrintStrategy = 1; |
|
92 |
setLog.nPrintStrategy = 0; |
|
93 |
bLogopen = NetSdk.CLIENT_LogOpen(setLog); |
|
94 |
if(!bLogopen ) { |
|
95 |
System.err.println("Failed to open NetSDK log"); |
|
96 |
} |
|
97 |
|
|
98 |
// 设置断线重连回调接口,设置过断线重连成功回调函数后,当设备出现断线情况,SDK内部会自动进行重连操作 |
|
99 |
// 此操作为可选操作,但建议用户进行设置 |
|
100 |
NetSdk.CLIENT_SetAutoReconnect(haveReConnect, null); |
|
101 |
|
|
102 |
//设置登录超时时间和尝试次数,可选 |
|
103 |
int waitTime = 5000; //登录请求响应超时时间设置为5S |
|
104 |
int tryTimes = 3; //登录时尝试建立链接3次 |
|
105 |
NetSdk.CLIENT_SetConnectTime(waitTime, tryTimes); |
|
106 |
|
|
107 |
// 设置更多网络参数,NET_PARAM的nWaittime,nConnectTryNum成员与CLIENT_SetConnectTime |
|
108 |
// 接口设置的登录设备超时时间和尝试次数意义相同,可选 |
|
109 |
NetSDKLib.NET_PARAM netParam = new NetSDKLib.NET_PARAM(); |
|
110 |
netParam.nConnectTime = 10000; //登录时尝试建立链接的超时时间 |
|
111 |
NetSdk.CLIENT_SetNetworkParam(netParam); |
|
112 |
return true; |
|
113 |
} |
|
114 |
|
|
115 |
//清除环境 |
|
116 |
public void cleanup() { |
|
117 |
if(bLogopen) { |
|
118 |
NetSdk.CLIENT_LogClose(); |
|
119 |
} |
|
120 |
|
|
121 |
if(bInit) { |
|
122 |
NetSdk.CLIENT_Cleanup(); |
|
123 |
} |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
private SDKEnvironment sdkEnv; |
|
128 |
|
|
129 |
public JNATrafficListFrame() { |
|
130 |
sdkEnv = new SDKEnvironment(); |
|
131 |
sdkEnv.init(); |
|
132 |
setTitle(Res.string().getTrafficAllowList()); |
|
133 |
setSize(900, 650); |
|
134 |
setLayout(new BorderLayout()); |
|
135 |
setLocationRelativeTo(null); |
|
136 |
setVisible(true); |
|
137 |
|
|
138 |
loginPanel = new LoginPanel(); |
|
139 |
TrafficPanel trafficPanel = new TrafficPanel(); |
|
140 |
QueryViewPanel queryViewPanel = new QueryViewPanel(); |
|
141 |
|
|
142 |
add(loginPanel, BorderLayout.NORTH); |
|
143 |
add(trafficPanel, BorderLayout.WEST); |
|
144 |
add(queryViewPanel, BorderLayout.CENTER); |
|
145 |
|
|
146 |
addWindowListener(new WindowAdapter() { |
|
147 |
public void windowClosing(WindowEvent e) { |
|
148 |
System.out.println("Window Closing"); |
|
149 |
//登出 |
|
150 |
logoutButtonPerformed(null); |
|
151 |
dispose(); |
|
152 |
|
|
153 |
// 返回主菜单 |
|
154 |
SwingUtilities.invokeLater(new Runnable() { |
|
155 |
public void run() { |
|
156 |
FunctionList demo = new FunctionList(); |
|
157 |
demo.setVisible(true); |
|
158 |
} |
|
159 |
}); |
|
160 |
} |
|
161 |
}); |
|
162 |
|
|
163 |
} |
|
164 |
|
|
165 |
/////////////////面板/////////////////// |
|
166 |
////////////////////////////////////// |
|
167 |
//设置边框 |
|
168 |
private void setBorderEx(JComponent object, String title, int width) { |
|
169 |
Border innerBorder = BorderFactory.createTitledBorder(title); |
|
170 |
Border outerBorder = BorderFactory.createEmptyBorder(width, width, width, width); |
|
171 |
object.setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder)); |
|
172 |
} |
|
173 |
|
|
174 |
//登录面板 |
|
175 |
public class LoginPanel extends JPanel { |
|
176 |
/** |
|
177 |
* |
|
178 |
*/ |
|
179 |
private static final long serialVersionUID = 1L; |
|
180 |
|
|
181 |
public LoginPanel() { |
|
182 |
loginBtn = new JButton(Res.string().getLogin()); |
|
183 |
logoutBtn = new JButton(Res.string().getLogout()); |
|
184 |
nameLabel = new JLabel(Res.string().getUserName()); |
|
185 |
passwordLabel = new JLabel(Res.string().getPassword()); |
|
186 |
nameTextArea = new JTextField(m_strUser, 8); |
|
187 |
passwordTextArea = new JPasswordField(m_strPassword, 8); |
|
188 |
ipLabel = new JLabel(Res.string().getIp()); |
|
189 |
portLabel = new JLabel(Res.string().getPort()); |
|
190 |
ipTextArea = new JTextField(m_strIp, 16); |
|
191 |
portTextArea = new JTextField(m_nPort.toString(), 8); |
|
192 |
|
|
193 |
setLayout(new FlowLayout()); |
|
194 |
setBorderEx(this, Res.string().getLogin(), 2); |
|
195 |
|
|
196 |
add(ipLabel); |
|
197 |
add(ipTextArea); |
|
198 |
add(portLabel); |
|
199 |
add(portTextArea); |
|
200 |
add(nameLabel); |
|
201 |
add(nameTextArea); |
|
202 |
add(passwordLabel); |
|
203 |
add(passwordTextArea); |
|
204 |
add(loginBtn); |
|
205 |
add(logoutBtn); |
|
206 |
|
|
207 |
logoutBtn.setEnabled(false); |
|
208 |
|
|
209 |
//登录按钮,监听事件 |
|
210 |
loginBtn.addActionListener(new ActionListener() { |
|
211 |
public void actionPerformed(ActionEvent e) { |
|
212 |
new SDKEnvironment().init(); |
|
213 |
loginButtonPerformed(e); |
|
214 |
} |
|
215 |
}); |
|
216 |
|
|
217 |
//登出按钮,监听事件 |
|
218 |
logoutBtn.addActionListener(new ActionListener(){ |
|
219 |
public void actionPerformed(ActionEvent e) { |
|
220 |
logoutButtonPerformed(e); |
|
221 |
} |
|
222 |
}); |
|
223 |
} |
|
224 |
} |
|
225 |
|
|
226 |
//允许名单操作面板 |
|
227 |
public class TrafficPanel extends JPanel { |
|
228 |
/** |
|
229 |
* |
|
230 |
*/ |
|
231 |
private static final long serialVersionUID = 1L; |
|
232 |
|
|
233 |
public TrafficPanel() { |
|
234 |
setBorderEx(this,Res.string().getAllowlistOperation(), 4); |
|
235 |
Dimension dim = this.getPreferredSize(); |
|
236 |
dim.width = 300; |
|
237 |
this.setPreferredSize(dim); |
|
238 |
|
|
239 |
SinglePanel singlePanel = new SinglePanel(); |
|
240 |
BatchPanel batchPanel = new BatchPanel(); |
|
241 |
setLayout(new BorderLayout()); |
|
242 |
add(singlePanel, BorderLayout.NORTH); |
|
243 |
add(batchPanel, BorderLayout.SOUTH); |
|
244 |
} |
|
245 |
} |
|
246 |
|
|
247 |
// 单个上传面板 |
|
248 |
public class SinglePanel extends JPanel { |
|
249 |
/** |
|
250 |
* |
|
251 |
*/ |
|
252 |
private static final long serialVersionUID = 1L; |
|
253 |
|
|
254 |
public SinglePanel(){ |
|
255 |
setBorderEx(this, Res.string().getSingleUpload(), 4); |
|
256 |
Dimension dim = this.getPreferredSize(); |
|
257 |
dim.height = 200; |
|
258 |
this.setPreferredSize(dim); |
|
259 |
setLayout(new GridLayout(4, 2, 30, 20)); |
|
260 |
|
|
261 |
numLabel = new JLabel( Res.string().getLicensePlateRun()); |
|
262 |
numTextArea = new JTextField(""); |
|
263 |
// queryBtn = new JButton("查询"); |
|
264 |
queryExBtn = new JButton(Res.string().getFuzzyQuery()); |
|
265 |
addBtn = new JButton(Res.string().getAdd()); |
|
266 |
deleteBtn = new JButton(Res.string().getDelete()); |
|
267 |
modifyBtn = new JButton(Res.string().getModify()); |
|
268 |
alldeleteBtn = new JButton(Res.string().getDeleteAll()); |
|
269 |
|
|
270 |
// queryBtn.setEnabled(false); |
|
271 |
queryExBtn.setEnabled(false); |
|
272 |
addBtn.setEnabled(false); |
|
273 |
deleteBtn.setEnabled(false); |
|
274 |
modifyBtn.setEnabled(false); |
|
275 |
alldeleteBtn.setEnabled(false); |
|
276 |
|
|
277 |
add(numLabel); |
|
278 |
add(numTextArea); |
|
279 |
// add(queryBtn); |
|
280 |
add(queryExBtn); |
|
281 |
add(addBtn); |
|
282 |
add(deleteBtn); |
|
283 |
add(modifyBtn); |
|
284 |
add(alldeleteBtn); |
|
285 |
|
|
286 |
/* queryBtn.addActionListener(new ActionListener() { |
|
287 |
public void actionPerformed(ActionEvent e) { |
|
288 |
DefaultTableModel model = (DefaultTableModel)table.getModel(); |
|
289 |
model.setRowCount(0); // 在模糊查询前,清空表格 |
|
290 |
data = new Object[200][6]; // 再重设表格, |
|
291 |
query(); |
|
292 |
} |
|
293 |
});*/ |
|
294 |
queryExBtn.addActionListener(new ActionListener() { |
|
295 |
public void actionPerformed(ActionEvent e) { |
|
296 |
DefaultTableModel model = (DefaultTableModel)table.getModel(); |
|
297 |
model.setRowCount(0); // 在模糊查询前,清空表格 |
|
298 |
data = new Object[200][6]; // 再重设表格, |
|
299 |
queryEx(); |
|
300 |
} |
|
301 |
}); |
|
302 |
addBtn.addActionListener(new ActionListener() { |
|
303 |
public void actionPerformed(ActionEvent e) { |
|
304 |
new AddFrame(); |
|
305 |
} |
|
306 |
}); |
|
307 |
deleteBtn.addActionListener(new ActionListener() { |
|
308 |
public void actionPerformed(ActionEvent e) { |
|
309 |
int rowCount = table.getSelectedRowCount(); |
|
310 |
if(rowCount > 0) { |
|
311 |
deleteOperate(); |
|
312 |
int row = table.getSelectedRow(); |
|
313 |
DefaultTableModel model = (DefaultTableModel)table.getModel(); |
|
314 |
model.removeRow(row); // 删除选中的行 |
|
315 |
data = new Object[200][6]; // 再重设表格, |
|
316 |
} else { |
|
317 |
|
|
318 |
JOptionPane.showMessageDialog(null, Res.string().getSelectData()); |
|
319 |
} |
|
320 |
} |
|
321 |
}); |
|
322 |
modifyBtn.addActionListener(new ActionListener() { |
|
323 |
public void actionPerformed(ActionEvent e) { |
|
324 |
int rowCount = table.getSelectedRowCount(); |
|
325 |
if(rowCount > 0) { |
|
326 |
new ModifyFrame(); |
|
327 |
int row = table.getSelectedRow(); //获得所选的单行 |
|
328 |
nullTextArea31.setText(String.valueOf(model.getValueAt(row, 1))); |
|
329 |
nullTextArea41.setText(String.valueOf(model.getValueAt(row, 2))); |
|
330 |
startTextArea1.setText(String.valueOf(model.getValueAt(row, 3))); |
|
331 |
endTextArea1.setText(String.valueOf(model.getValueAt(row, 4))); |
|
332 |
if((model.getValueAt(row, 5)).equals(Res.string().getAuthorization())) { |
|
333 |
jr1.setSelected(true); |
|
334 |
} else { |
|
335 |
jr1.setSelected(false); |
|
336 |
} |
|
337 |
} else { |
|
338 |
JOptionPane.showMessageDialog(null, Res.string().getSelectData()); |
|
339 |
} |
|
340 |
} |
|
341 |
}); |
|
342 |
alldeleteBtn.addActionListener(new ActionListener() { |
|
343 |
public void actionPerformed(ActionEvent e) { |
|
344 |
alldeleteOperate(); |
|
345 |
} |
|
346 |
}); |
|
347 |
} |
|
348 |
} |
|
349 |
|
|
350 |
// 批量上传面板 |
|
351 |
public class BatchPanel extends JPanel { |
|
352 |
/** |
|
353 |
* |
|
354 |
*/ |
|
355 |
private static final long serialVersionUID = 1L; |
|
356 |
|
|
357 |
public BatchPanel() { |
|
358 |
setBorderEx(this, Res.string().getBatchUpload(), 4); |
|
359 |
Dimension dim = this.getPreferredSize(); |
|
360 |
dim.height = 150; |
|
361 |
this.setPreferredSize(dim); |
|
362 |
setLayout(new GridLayout(3, 2, 30, 20)); |
|
363 |
|
|
364 |
browseTextArea = new JTextField(); |
|
365 |
browseBtn = new JButton(Res.string().getBrowse()); |
|
366 |
nullLabel1 = new JLabel(""); |
|
367 |
upLoadBtn = new JButton(Res.string().getUpload()); |
|
368 |
nullLabel2 = new JLabel(""); |
|
369 |
|
|
370 |
browseTextArea.setEditable(false); |
|
371 |
browseBtn.setEnabled(false); |
|
372 |
upLoadBtn.setEnabled(false); |
|
373 |
|
|
374 |
add(browseTextArea); |
|
375 |
add(browseBtn); |
|
376 |
add(nullLabel1); |
|
377 |
add(upLoadBtn); |
|
378 |
add(nullLabel2); |
|
379 |
|
|
380 |
final File[] file = new File[1]; |
|
381 |
browseBtn.addActionListener(new ActionListener() { |
|
382 |
public void actionPerformed(ActionEvent e) { |
|
383 |
jfc = new JFileChooser(); |
|
384 |
jfc.setMultiSelectionEnabled(true); //可以拖选多个文件 |
|
385 |
jfc.setAcceptAllFileFilterUsed(false); //关掉显示所有 |
|
386 |
//添加过滤器 |
|
387 |
jfc.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() { |
|
388 |
public boolean accept(File f) { |
|
389 |
if(f.getName().endsWith(".CSV")||f.isDirectory()) { |
|
390 |
file[0] =f; |
|
391 |
return true; |
|
392 |
} |
|
393 |
return false; |
|
394 |
} |
|
395 |
public String getDescription() { |
|
396 |
return ".CSV"; |
|
397 |
} |
|
398 |
}); |
|
399 |
if(jfc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { |
|
400 |
System.out.println(jfc.getSelectedFile().getAbsolutePath()); |
|
401 |
browseTextArea.setText(jfc.getSelectedFile().getAbsolutePath()); |
|
402 |
} |
|
403 |
} |
|
404 |
}); |
|
405 |
|
|
406 |
upLoadBtn.addActionListener(new ActionListener() { |
|
407 |
public void actionPerformed(ActionEvent e) { |
|
408 |
|
|
409 |
if(browseTextArea.getText().isEmpty()){ |
|
410 |
|
|
411 |
}else { |
|
412 |
|
|
413 |
|
|
414 |
String uploading = Res.string().getUploading(); |
|
415 |
upLoadBtn.setLabel(uploading); |
|
416 |
JOptionPane jOptionPane=new JOptionPane(); |
|
417 |
if(uploading.equals("uploading")){ |
|
418 |
jOptionPane.setDefaultLocale(ENGLISH); |
|
419 |
} |
|
420 |
|
|
421 |
if( jOptionPane.showConfirmDialog(null, Res.string().getSureUpload())==JOptionPane.OK_OPTION){ |
|
422 |
upLoad(); |
|
423 |
} |
|
424 |
|
|
425 |
upLoadBtn.setLabel(Res.string().getUpload()); |
|
426 |
} |
|
427 |
} |
|
428 |
}); |
|
429 |
} |
|
430 |
} |
|
431 |
|
|
432 |
// 查询显示 面板 |
|
433 |
public class QueryViewPanel extends JPanel { |
|
434 |
/** |
|
435 |
* |
|
436 |
*/ |
|
437 |
private static final long serialVersionUID = 1L; |
|
438 |
|
|
439 |
public QueryViewPanel() { |
|
440 |
setBorderEx(this, Res.string().getQueryInformation() , 4); |
|
441 |
setLayout(new BorderLayout()); |
|
442 |
|
|
443 |
// 在JTable列表里添加一个模版,信息存在模版里 |
|
444 |
data = new Object[200][6]; |
|
445 |
model = new DefaultTableModel(data, name); |
|
446 |
table = new JTable(model); |
|
447 |
|
|
448 |
// 设置某列的宽度 |
|
449 |
table.getColumnModel().getColumn(0).setPreferredWidth(40); |
|
450 |
table.getColumnModel().getColumn(3).setPreferredWidth(120); |
|
451 |
table.getColumnModel().getColumn(4).setPreferredWidth(120); |
|
452 |
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 只能选中一行 |
|
453 |
|
|
454 |
// 建立滑动面板,并插入列表 |
|
455 |
JScrollPane scrollPane = new JScrollPane(table); |
|
456 |
add(scrollPane, BorderLayout.CENTER); |
|
457 |
} |
|
458 |
} |
|
459 |
|
|
460 |
//添加按钮窗口 |
|
461 |
public class AddFrame extends Frame{ |
|
462 |
/** |
|
463 |
* |
|
464 |
*/ |
|
465 |
private static final long serialVersionUID = 1L; |
|
466 |
public AddFrame(){ |
|
467 |
setTitle(Res.string().getDialog()); |
|
468 |
setSize(450, 450); |
|
469 |
setLocationRelativeTo(null); |
|
470 |
setVisible(true); |
|
471 |
setLayout(new BorderLayout()); |
|
472 |
DialogPanel dialogPanel = new DialogPanel(); |
|
473 |
add(dialogPanel, BorderLayout.CENTER); |
|
474 |
addWindowListener(new WindowAdapter() { |
|
475 |
public void windowClosing(WindowEvent e){ |
|
476 |
dispose(); |
|
477 |
} |
|
478 |
}); |
|
479 |
} |
|
480 |
public class DialogPanel extends JPanel{ |
|
481 |
/** |
|
482 |
* |
|
483 |
*/ |
|
484 |
private static final long serialVersionUID = 1L; |
|
485 |
|
|
486 |
public DialogPanel() { |
|
487 |
setBorderEx(this, Res.string().getAdd(), 4); |
|
488 |
Dimension dim = this.getPreferredSize(); |
|
489 |
dim.height = 400; |
|
490 |
dim.width = 400; |
|
491 |
this.setPreferredSize(dim); |
|
492 |
setLayout(new GridLayout(3, 1)); |
|
493 |
JPanel jp11 = new JPanel(); |
|
494 |
JPanel jp1 = new JPanel(); |
|
495 |
JPanel jp2 = new JPanel(); |
|
496 |
JPanel jp3 = new JPanel(); |
|
497 |
|
|
498 |
numberLabel = new JLabel(Res.string().getLicensePlateNumber()); |
|
499 |
String[] str; |
|
500 |
if(Res.string().getLicensePlateNumber().equals("license plate number")){ |
|
501 |
str= new String[]{"jing", "jin", "ji"}; |
|
502 |
}else { |
|
503 |
//下拉菜单设置选项 |
|
504 |
str = new String[]{"京", "津", "冀", "晋", "内蒙古", "辽", "吉", "黑", "沪", "鲁", "苏", "浙", "皖", "闽", "赣", "豫", "鄂", "湘", |
|
505 |
"粤", "桂", "琼", "渝", "川", "贵", "云", "藏", "陕", "甘", "青", "宁", "新", "港", "澳", "台"}; |
|
506 |
} |
|
507 |
|
|
508 |
/*ComboBoxModel jComboBoxModel = new DefaultComboBoxModel(str); |
|
509 |
jComboBox.setModel(jComboBoxModel);*/ |
|
510 |
jComboBox = new JComboBox(str); |
|
511 |
jComboBox.setPreferredSize(new Dimension(100, 25)); // 设置宽度 |
|
512 |
|
|
513 |
nullTextArea3 = new JTextField(8); |
|
514 |
userLabel = new JLabel(Res.string().getCarOwner()); |
|
515 |
nullTextArea4 = new JTextField(8); |
|
516 |
startTime = new JLabel(Res.string().getStartTime()); |
|
517 |
startTextArea = new JTextField("2021/11/1 6:07:07"); |
|
518 |
stopTime = new JLabel(Res.string().getEndTime()); |
|
519 |
endTextArea = new JTextField("2021/11/1 8:08:07"); |
|
520 |
|
|
521 |
jr = new JRadioButton(Res.string().getAuthorization()); |
|
522 |
jr.setSelected(true); |
|
523 |
okBtn = new JButton(Res.string().getConfirm()); |
|
524 |
cancleBtn = new JButton(Res.string().getCancel()); |
|
525 |
|
|
526 |
jp11.setLayout(new FlowLayout(FlowLayout.CENTER)); |
|
527 |
jp11.add(jComboBox); |
|
528 |
jp11.add(nullTextArea3); |
|
529 |
|
|
530 |
jp1.setLayout(new GridLayout(4, 2, 1, 8)); |
|
531 |
jp1.add(numberLabel); |
|
532 |
jp1.add(jp11); |
|
533 |
jp1.add(userLabel); |
|
534 |
jp1.add(nullTextArea4); |
|
535 |
jp1.add(startTime); |
|
536 |
jp1.add(startTextArea); |
|
537 |
|
|
538 |
jp1.add(stopTime); |
|
539 |
jp1.add(endTextArea); |
|
540 |
|
|
541 |
jp2.setLayout(new FlowLayout(FlowLayout.CENTER)); |
|
542 |
jp2.add(jr); |
|
543 |
|
|
544 |
jp3.setLayout(new FlowLayout(FlowLayout.CENTER)); |
|
545 |
jp3.add(okBtn); |
|
546 |
jp3.add(cancleBtn); |
|
547 |
|
|
548 |
add(jp1); |
|
549 |
add(jp2); |
|
550 |
add(jp3); |
|
551 |
|
|
552 |
okBtn.addActionListener(new ActionListener() { |
|
553 |
public void actionPerformed(ActionEvent e) { |
|
554 |
if(jr.isSelected()) { |
|
555 |
pstRecordAdd.stAuthrityTypes[0].emAuthorityType = NetSDKLib.EM_NET_AUTHORITY_TYPE.NET_AUTHORITY_OPEN_GATE; |
|
556 |
pstRecordAdd.stAuthrityTypes[0].bAuthorityEnable = 1; |
|
557 |
} else { |
|
558 |
pstRecordAdd.stAuthrityTypes[0].emAuthorityType = NetSDKLib.EM_NET_AUTHORITY_TYPE.NET_AUTHORITY_OPEN_GATE; |
|
559 |
pstRecordAdd.stAuthrityTypes[0].bAuthorityEnable = 0; |
|
560 |
} |
|
561 |
addOperate(); |
|
562 |
dispose(); |
|
563 |
} |
|
564 |
}); |
|
565 |
|
|
566 |
cancleBtn.addActionListener(new ActionListener() { |
|
567 |
public void actionPerformed(ActionEvent e) { |
|
568 |
dispose(); |
|
569 |
} |
|
570 |
}); |
|
571 |
} |
|
572 |
} |
|
573 |
} |
|
574 |
// 修改按钮窗口 |
|
575 |
public class ModifyFrame extends Frame{ |
|
576 |
/** |
|
577 |
* |
|
578 |
*/ |
|
579 |
private static final long serialVersionUID = 1L; |
|
580 |
public ModifyFrame(){ |
|
581 |
setTitle(Res.string().getModifyPanel()); |
|
582 |
setSize(450, 350); |
|
583 |
setLocationRelativeTo(null); |
|
584 |
setVisible(true); |
|
585 |
setLayout(new BorderLayout()); |
|
586 |
ModifyPanel modifyPanel = new ModifyPanel(); |
|
587 |
add(modifyPanel, BorderLayout.CENTER); |
|
588 |
addWindowListener(new WindowAdapter() { |
|
589 |
public void windowClosing(WindowEvent e){ |
|
590 |
dispose(); |
|
591 |
} |
|
592 |
}); |
|
593 |
} |
|
594 |
public class ModifyPanel extends JPanel{ |
|
595 |
/** |
|
596 |
* |
|
597 |
*/ |
|
598 |
private static final long serialVersionUID = 1L; |
|
599 |
|
|
600 |
public ModifyPanel() { |
|
601 |
setBorderEx(this, Res.string().getModify(), 3); |
|
602 |
Dimension dim = this.getPreferredSize(); |
|
603 |
dim.height = 450; |
|
604 |
dim.width = 350; |
|
605 |
|
|
606 |
this.setPreferredSize(dim); |
|
607 |
setLayout(new GridLayout(3, 1,2,2)); |
|
608 |
JPanel jp111 = new JPanel(); |
|
609 |
JPanel jp11 = new JPanel(); |
|
610 |
JPanel jp21 = new JPanel(); |
|
611 |
JPanel jp31 = new JPanel(); |
|
612 |
|
|
613 |
numberLabel1 = new JLabel(Res.string().getLicensePlateNumber()); |
|
614 |
nullTextArea31 = new JTextField(33); |
|
615 |
nullTextArea31.setEditable(true); |
|
616 |
userLabel1 = new JLabel(Res.string().getCarOwner()); |
|
617 |
nullTextArea41 = new JTextField(8); |
|
618 |
startTime1 = new JLabel(Res.string().getStartTime()); |
|
619 |
startTextArea1 = new JTextField("2021/11/1 6:07:07"); |
|
620 |
stopTime1 = new JLabel(Res.string().getEndTime()); |
|
621 |
endTextArea1 = new JTextField("2021/11/1 8:08:07"); |
|
622 |
|
|
623 |
jr1 = new JRadioButton(Res.string().getAuthorization()); |
|
624 |
okBtn1 = new JButton(Res.string().getConfirm()); |
|
625 |
cancleBtn1 = new JButton(Res.string().getCancel()); |
|
626 |
|
|
627 |
jp111.setLayout(new FlowLayout(FlowLayout.CENTER)); |
|
628 |
jp111.add(nullTextArea31); |
|
629 |
|
|
630 |
jp11.setLayout(new GridLayout(4, 2, 1, 1)); |
|
631 |
|
|
632 |
jp11.add(numberLabel1); |
|
633 |
jp11.add(jp111); |
|
634 |
jp11.add(userLabel1); |
|
635 |
jp11.add(nullTextArea41); |
|
636 |
jp11.add(startTime1); |
|
637 |
jp11.add(startTextArea1); |
|
638 |
|
|
639 |
jp11.add(stopTime1); |
|
640 |
jp11.add(endTextArea1); |
|
641 |
|
|
642 |
jp21.setLayout(new FlowLayout(FlowLayout.CENTER)); |
|
643 |
jp21.add(jr1); |
|
644 |
|
|
645 |
|
|
646 |
jp31.setLayout(new FlowLayout(FlowLayout.CENTER)); |
|
647 |
jp31.add(okBtn1); |
|
648 |
jp31.add(cancleBtn1); |
|
649 |
|
|
650 |
add(jp11); |
|
651 |
add(jp21); |
|
652 |
add(jp31); |
|
653 |
|
|
654 |
okBtn1.addActionListener(new ActionListener() { |
|
655 |
|
|
656 |
|
|
657 |
public void actionPerformed(ActionEvent e) { |
|
658 |
|
|
659 |
|
|
660 |
|
|
661 |
if(jr1.isSelected()) { |
|
662 |
pstRecordAdd.stAuthrityTypes[0].emAuthorityType = NetSDKLib.EM_NET_AUTHORITY_TYPE.NET_AUTHORITY_OPEN_GATE; |
|
663 |
pstRecordAdd.stAuthrityTypes[0].bAuthorityEnable = 1; |
|
664 |
} else { |
|
665 |
pstRecordAdd.stAuthrityTypes[0].emAuthorityType = NetSDKLib.EM_NET_AUTHORITY_TYPE.NET_AUTHORITY_OPEN_GATE; |
|
666 |
pstRecordAdd.stAuthrityTypes[0].bAuthorityEnable = 0; |
|
667 |
} |
|
668 |
modifyOperate(); |
|
669 |
dispose(); |
|
670 |
} |
|
671 |
}); |
|
672 |
|
|
673 |
cancleBtn1.addActionListener(new ActionListener() { |
|
674 |
public void actionPerformed(ActionEvent e) { |
|
675 |
dispose(); |
|
676 |
} |
|
677 |
}); |
|
678 |
} |
|
679 |
} |
|
680 |
} |
|
681 |
|
|
682 |
////////////////////事件执行////////////////////// |
|
683 |
/////////////////////////////////////////////// |
|
684 |
//登录按钮事件 |
|
685 |
private void loginButtonPerformed(ActionEvent e) { |
|
686 |
m_strIp = ipTextArea.getText(); |
|
687 |
m_nPort = Integer.parseInt(portTextArea.getText()); |
|
688 |
m_strUser = nameTextArea.getText(); |
|
689 |
m_strPassword = new String(passwordTextArea.getPassword()); |
|
690 |
|
|
691 |
System.out.println("设备地址:" + m_strIp + "\n端口号:" + m_nPort |
|
692 |
+ "\n用户名:" + m_strUser + "\n密码:" + m_strPassword); |
|
693 |
|
|
694 |
int nSpecCap = NetSDKLib.EM_LOGIN_SPAC_CAP_TYPE.EM_LOGIN_SPEC_CAP_TCP; //=0 |
|
695 |
IntByReference nError = new IntByReference(0); |
|
696 |
m_hLoginHandle = NetSdk.CLIENT_LoginEx2(m_strIp, m_nPort.intValue(), m_strUser, m_strPassword, nSpecCap, null, m_stDeviceInfo, nError); |
|
697 |
if(m_hLoginHandle.longValue() == 0) { |
|
698 |
int error = 0; |
|
699 |
error = NetSdk.CLIENT_GetLastError(); |
|
700 |
System.err.printf("Login Device[%s] Port[%d]Failed. Last Error[0x%x]\n", m_strIp, m_nPort, error); |
|
701 |
JOptionPane.showMessageDialog(this, Res.string().getLoginFailed()+":" + String.format("[0x%x]", error)); |
|
702 |
} else { |
|
703 |
System.out.println("Login Success [ " + m_strIp + " ]"); |
|
704 |
JOptionPane.showMessageDialog(this, Res.string().getLoginSuccess()); |
|
705 |
logoutBtn.setEnabled(true); |
|
706 |
loginBtn.setEnabled(false); |
|
707 |
// queryBtn.setEnabled(true); |
|
708 |
queryExBtn.setEnabled(true); |
|
709 |
addBtn.setEnabled(true); |
|
710 |
deleteBtn.setEnabled(true); |
|
711 |
modifyBtn.setEnabled(true); |
|
712 |
browseBtn.setEnabled(true); |
|
713 |
upLoadBtn.setEnabled(true); |
|
714 |
alldeleteBtn.setEnabled(true); |
|
715 |
} |
|
716 |
} |
|
717 |
|
|
718 |
//登出按钮事件 |
|
719 |
private void logoutButtonPerformed(ActionEvent e) { |
|
720 |
if(m_hLoginHandle.longValue() != 0) { |
|
721 |
System.out.println("Logout Button Action"); |
|
722 |
|
|
723 |
if(NetSdk.CLIENT_Logout(m_hLoginHandle)) { |
|
724 |
System.out.println("Logout Success [ " + m_strIp + " ]"); |
|
725 |
m_hLoginHandle.setValue(0); |
|
726 |
logoutBtn.setEnabled(false); |
|
727 |
loginBtn.setEnabled(true); |
|
728 |
// queryBtn.setEnabled(false); |
|
729 |
queryExBtn.setEnabled(false); |
|
730 |
addBtn.setEnabled(false); |
|
731 |
deleteBtn.setEnabled(false); |
|
732 |
modifyBtn.setEnabled(false); |
|
733 |
browseBtn.setEnabled(false); |
|
734 |
upLoadBtn.setEnabled(false); |
|
735 |
|
|
736 |
} |
|
737 |
} |
|
738 |
} |
|
739 |
|
|
740 |
// 查询按钮事件 |
|
741 |
private void query() { |
|
742 |
// 开始查询记录 |
|
743 |
NetSDKLib.NET_IN_FIND_RECORD_PARAM stuFindInParam = new NetSDKLib.NET_IN_FIND_RECORD_PARAM(); |
|
744 |
stuFindInParam.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST; |
|
745 |
|
|
746 |
NetSDKLib.FIND_RECORD_TRAFFICREDLIST_CONDITION stuRedListCondition = new NetSDKLib.FIND_RECORD_TRAFFICREDLIST_CONDITION(); |
|
747 |
stuFindInParam.pQueryCondition = stuRedListCondition.getPointer(); |
|
748 |
byte[] numText; |
|
749 |
try { |
|
750 |
|
|
751 |
numText = numTextArea.getText().trim().getBytes("GBK"); |
|
752 |
System.arraycopy(numText, 0, stuRedListCondition.szPlateNumber, 0, numText.length); |
|
753 |
} catch (UnsupportedEncodingException e) { |
|
754 |
System.err.println("字符串转码异常"); |
|
755 |
} |
|
756 |
|
|
757 |
|
|
758 |
NetSDKLib.NET_OUT_FIND_RECORD_PARAM stuFindOutParam = new NetSDKLib.NET_OUT_FIND_RECORD_PARAM(); |
|
759 |
|
|
760 |
if((numTextArea.getText()).equals("")) { |
|
761 |
JOptionPane.showMessageDialog(this, Res.string().getEnterQueryData()); |
|
762 |
}else { |
|
763 |
stuRedListCondition.write(); |
|
764 |
boolean bRet = NetSdk.CLIENT_FindRecord(m_hLoginHandle, stuFindInParam, stuFindOutParam, 5000); |
|
765 |
stuRedListCondition.read(); |
|
766 |
System.out.println("FindRecord Succeed" + "\n" + "FindHandle :" + stuFindOutParam.lFindeHandle); |
|
767 |
if(bRet) { |
|
768 |
int nRecordCount = 10; |
|
769 |
NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM stuFindNextInParam = new NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM(); |
|
770 |
stuFindNextInParam.lFindeHandle = stuFindOutParam.lFindeHandle; |
|
771 |
stuFindNextInParam.nFileCount = nRecordCount; //想查询的记录条数 |
|
772 |
|
|
773 |
NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM stuFindNextOutParam = new NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM(); |
|
774 |
stuFindNextOutParam.nMaxRecordNum = nRecordCount; |
|
775 |
NetSDKLib.NET_TRAFFIC_LIST_RECORD pstRecord = new NetSDKLib.NET_TRAFFIC_LIST_RECORD(); |
|
776 |
stuFindNextOutParam.pRecordList = pstRecord.getPointer(); |
|
777 |
|
|
778 |
pstRecord.write(); |
|
779 |
boolean zRet = NetSdk.CLIENT_FindNextRecord(stuFindNextInParam, stuFindNextOutParam, 5000); |
|
780 |
pstRecord.read(); |
|
781 |
|
|
782 |
if(zRet) { |
|
783 |
System.out.println("record are found!"); |
|
784 |
|
|
785 |
for(int i=0; i < stuFindNextOutParam.nRetRecordNum; i++) { |
|
786 |
data[i][0] = String.valueOf(i); |
|
787 |
try { |
|
788 |
data[i][1] = new String(pstRecord.szPlateNumber,"GBK").trim(); |
|
789 |
data[i][2] = new String(pstRecord.szMasterOfCar,"GBK").trim(); |
|
790 |
data[i][3] = pstRecord.stBeginTime.toStringTime(); |
|
791 |
data[i][4] = pstRecord.stCancelTime.toStringTime(); |
|
792 |
} catch (UnsupportedEncodingException e) { |
|
793 |
System.err.println("字符串转码异常"); |
|
794 |
} |
|
795 |
|
|
796 |
if(pstRecord.stAuthrityTypes[0].bAuthorityEnable == 1) { |
|
797 |
data[i][5] = "授权"; |
|
798 |
} else { |
|
799 |
data[i][5] = "不授权"; |
|
800 |
} |
|
801 |
model.setDataVector(data, name); |
|
802 |
} |
|
803 |
} |
|
804 |
|
|
805 |
NetSdk.CLIENT_FindRecordClose(stuFindOutParam.lFindeHandle); |
|
806 |
}else { |
|
807 |
System.err.println("Can Not Find This Record" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
808 |
} |
|
809 |
} |
|
810 |
} |
|
811 |
public static void ByteArrZero(byte[] dst) { |
|
812 |
// 清零 |
|
813 |
for (int i = 0; i < dst.length; ++i) { |
|
814 |
dst[i] = 0; |
|
815 |
} |
|
816 |
} |
|
817 |
// 模糊查询按钮事件 |
|
818 |
private void queryEx() { |
|
819 |
|
|
820 |
NetSDKLib.NET_IN_FIND_RECORD_PARAM stuFindInParam = new NetSDKLib.NET_IN_FIND_RECORD_PARAM(); |
|
821 |
stuFindInParam.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST; |
|
822 |
|
|
823 |
NetSDKLib.FIND_RECORD_TRAFFICREDLIST_CONDITION stuRedListConditionEx = new NetSDKLib.FIND_RECORD_TRAFFICREDLIST_CONDITION(); |
|
824 |
stuFindInParam.pQueryCondition = stuRedListConditionEx.getPointer(); |
|
825 |
JNATrafficListFrame.ByteArrZero(stuRedListConditionEx.szPlateNumberVague); |
|
826 |
|
|
827 |
try { |
|
828 |
byte[] numText = numTextArea.getText().trim().getBytes("GBK"); |
|
829 |
|
|
830 |
System.arraycopy(numText, 0, stuRedListConditionEx.szPlateNumberVague, 0, numText.length); |
|
831 |
} catch (UnsupportedEncodingException e) { |
|
832 |
System.err.println("字符串转码异常"); |
|
833 |
} |
|
834 |
|
|
835 |
|
|
836 |
NetSDKLib.NET_OUT_FIND_RECORD_PARAM stuFindOutParam = new NetSDKLib.NET_OUT_FIND_RECORD_PARAM(); |
|
837 |
|
|
838 |
stuRedListConditionEx.write(); |
|
839 |
boolean bRet = NetSdk.CLIENT_FindRecord(m_hLoginHandle, stuFindInParam, stuFindOutParam, 10000); |
|
840 |
stuRedListConditionEx.read(); |
|
841 |
int total=0; |
|
842 |
if(bRet) { |
|
843 |
int doNextCount = 0; |
|
844 |
while(true) { |
|
845 |
int nRecordCount = 10; |
|
846 |
NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM stuFindNextInParam = new NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM(); |
|
847 |
stuFindNextInParam.lFindeHandle = stuFindOutParam.lFindeHandle; |
|
848 |
stuFindNextInParam.nFileCount = nRecordCount; |
|
849 |
|
|
850 |
NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM stuFindNextOutParam = new NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM(); |
|
851 |
stuFindNextOutParam.nMaxRecordNum = nRecordCount; |
|
852 |
NetSDKLib.NET_TRAFFIC_LIST_RECORD pstRecordEx = new NetSDKLib.NET_TRAFFIC_LIST_RECORD(); |
|
853 |
stuFindNextOutParam.pRecordList = new Memory(pstRecordEx.dwSize * nRecordCount); //分配(stRecordEx.dwSize * nRecordCount)个内存 |
|
854 |
|
|
855 |
|
|
856 |
// 把内存里的dwSize赋值 |
|
857 |
for (int i=0; i<stuFindNextOutParam.nMaxRecordNum; ++i) |
|
858 |
{ |
|
859 |
ToolKits.SetStructDataToPointer(pstRecordEx, stuFindNextOutParam.pRecordList, i*pstRecordEx.dwSize); |
|
860 |
} |
|
861 |
|
|
862 |
pstRecordEx.write(); |
|
863 |
boolean zRet = NetSdk.CLIENT_FindNextRecord(stuFindNextInParam, stuFindNextOutParam, 10000); |
|
864 |
pstRecordEx.read(); |
|
865 |
|
|
866 |
int jnumber=stuFindNextOutParam.nRetRecordNum; |
|
867 |
|
|
868 |
if(zRet) { |
|
869 |
|
|
870 |
for(int i=0; i < jnumber; i++) { |
|
871 |
int item = i + doNextCount * nRecordCount; |
|
872 |
total=item+1; |
|
873 |
if(item>data.length-1){ |
|
874 |
|
|
875 |
continue; |
|
876 |
} |
|
877 |
data[item][0] = String.valueOf(item); |
|
878 |
ToolKits.GetPointerDataToStruct(stuFindNextOutParam.pRecordList, i*pstRecordEx.dwSize, pstRecordEx); |
|
879 |
try { |
|
880 |
data[item][1] = new String(pstRecordEx.szPlateNumber,"GBK").trim(); |
|
881 |
data[item][2] = new String(pstRecordEx.szMasterOfCar,"GBK").trim(); |
|
882 |
data[item][3] = pstRecordEx.stBeginTime.toStringTime(); |
|
883 |
data[item][4] = pstRecordEx.stCancelTime.toStringTime(); |
|
884 |
} catch (UnsupportedEncodingException e) { |
|
885 |
System.err.println("字符串转码异常"); |
|
886 |
} |
|
887 |
|
|
888 |
if(pstRecordEx.stAuthrityTypes[0].bAuthorityEnable == 1) { |
|
889 |
data[item][5] = Res.string().getAuthorization(); |
|
890 |
} else { |
|
891 |
data[item][5] =Res.string().getUnauthorization(); |
|
892 |
} |
|
893 |
|
|
894 |
model.setDataVector(data, name); |
|
895 |
|
|
896 |
} |
|
897 |
|
|
898 |
if (stuFindNextOutParam.nRetRecordNum < nRecordCount) |
|
899 |
{ |
|
900 |
break; |
|
901 |
} else { |
|
902 |
doNextCount ++; |
|
903 |
} |
|
904 |
} else { |
|
905 |
break; |
|
906 |
} |
|
907 |
} |
|
908 |
NetSdk.CLIENT_FindRecordClose(stuFindOutParam.lFindeHandle); |
|
909 |
|
|
910 |
JOptionPane.showMessageDialog(this, total+" "+Res.string().getDataNumber()); |
|
911 |
|
|
912 |
}else { |
|
913 |
System.err.println("Can Not Find This Record" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
914 |
} |
|
915 |
} |
|
916 |
|
|
917 |
// 添加按钮事件 |
|
918 |
private void addOperate() { |
|
919 |
NetSDKLib.NET_INSERT_RECORD_INFO stInsertInfo = new NetSDKLib.NET_INSERT_RECORD_INFO(); // 添加 |
|
920 |
|
|
921 |
NetSDKLib.NET_TRAFFIC_LIST_RECORD.ByReference stRec = new NetSDKLib.NET_TRAFFIC_LIST_RECORD.ByReference(); |
|
922 |
|
|
923 |
|
|
924 |
try { |
|
925 |
|
|
926 |
String plate = nullTextArea3.getText(); |
|
927 |
|
|
928 |
boolean matches = plate.matches("^[\\da-zA-Z]*$"); |
|
929 |
|
|
930 |
if(!matches){ |
|
931 |
JOptionPane.showMessageDialog(this, Res.string().getFillingRules()); |
|
932 |
return; |
|
933 |
} |
|
934 |
|
|
935 |
byte[] PlateNumber |
|
936 |
= (jComboBox.getSelectedItem().toString() + plate).getBytes("GBK"); |
|
937 |
|
|
938 |
if(PlateNumber.length>NET_MAX_PLATE_NUMBER_LEN){ |
|
939 |
JOptionPane.showMessageDialog(this, Res.string().getLicensePlateLengthTooLong()); |
|
940 |
|
|
941 |
return; |
|
942 |
} |
|
943 |
|
|
944 |
byte[] MasterOfCar = nullTextArea4.getText().getBytes("GBK"); |
|
945 |
|
|
946 |
if(MasterOfCar.length>NET_MAX_NAME_LEN){ |
|
947 |
JOptionPane.showMessageDialog(this, Res.string().getNameTooLong()); |
|
948 |
return; |
|
949 |
} |
|
950 |
|
|
951 |
stRec.szPlateNumber =PlateNumber; |
|
952 |
stRec.szMasterOfCar = MasterOfCar; |
|
953 |
} catch (UnsupportedEncodingException e) { |
|
954 |
System.err.println("字符串转码异常"); |
|
955 |
} |
|
956 |
|
|
957 |
String[] start = startTextArea.getText().split(" "); |
|
958 |
String st1 = start[0]; |
|
959 |
String st2 = start[1]; |
|
960 |
String[] start1 = st1.split("/"); //年月日 |
|
961 |
String[] start2 = st2.split(":"); // 时分 |
|
962 |
String[] end = endTextArea.getText().split(" "); |
|
963 |
String ed1 = end[0]; |
|
964 |
String ed2 = end[1]; |
|
965 |
String[] end1 = ed1.split("/"); //年月日 |
|
966 |
String[] end2 = ed2.split(":"); // 时分 |
|
967 |
stRec.stBeginTime.dwYear = Integer.parseInt(start1[0]); |
|
968 |
stRec.stBeginTime.dwMonth = Integer.parseInt(start1[1]); |
|
969 |
stRec.stBeginTime.dwDay = Integer.parseInt(start1[2]); |
|
970 |
stRec.stBeginTime.dwHour = Integer.parseInt(start2[0]); |
|
971 |
stRec.stBeginTime.dwMinute = Integer.parseInt(start2[1]); |
|
972 |
stRec.stBeginTime.dwSecond = Integer.parseInt(start2[2]); |
|
973 |
stRec.stCancelTime.dwYear = Integer.parseInt(end1[0]); |
|
974 |
stRec.stCancelTime.dwMonth = Integer.parseInt(end1[1]); |
|
975 |
stRec.stCancelTime.dwDay = Integer.parseInt(end1[2]); |
|
976 |
stRec.stCancelTime.dwHour = Integer.parseInt(end2[0]); |
|
977 |
stRec.stCancelTime.dwMinute = Integer.parseInt(end2[1]); |
|
978 |
stRec.stCancelTime.dwSecond = Integer.parseInt(end2[2]); |
|
979 |
stRec.nAuthrityNum = 1; |
|
980 |
stRec.stAuthrityTypes[0].emAuthorityType = pstRecordAdd.stAuthrityTypes[0].emAuthorityType; |
|
981 |
stRec.stAuthrityTypes[0].bAuthorityEnable = pstRecordAdd.stAuthrityTypes[0].bAuthorityEnable; |
|
982 |
|
|
983 |
stInsertInfo.pRecordInfo = stRec; |
|
984 |
|
|
985 |
NetSDKLib.NET_IN_OPERATE_TRAFFIC_LIST_RECORD stInParam = new NetSDKLib.NET_IN_OPERATE_TRAFFIC_LIST_RECORD(); |
|
986 |
stInParam.emOperateType = NetSDKLib.EM_RECORD_OPERATE_TYPE.NET_TRAFFIC_LIST_INSERT; |
|
987 |
stInParam.emRecordType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST; |
|
988 |
stInParam.pstOpreateInfo = stInsertInfo.getPointer(); |
|
989 |
|
|
990 |
NetSDKLib.NET_OUT_OPERATE_TRAFFIC_LIST_RECORD stOutParam = new NetSDKLib.NET_OUT_OPERATE_TRAFFIC_LIST_RECORD(); |
|
991 |
stRec.write(); |
|
992 |
stInsertInfo.write(); |
|
993 |
stInParam.write(); |
|
994 |
|
|
995 |
boolean zRet = NetSdk.CLIENT_OperateTrafficList(m_hLoginHandle, stInParam, stOutParam, 5000); |
|
996 |
if(zRet) { |
|
997 |
stInParam.read(); |
|
998 |
System.out.println("succeed!"); |
|
999 |
JOptionPane.showMessageDialog(this, Res.string().getAddSuccess()); |
|
1000 |
} else { |
|
1001 |
System.err.println("failed!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1002 |
JOptionPane.showMessageDialog(this, Res.string().getAddFail()); |
|
1003 |
} |
|
1004 |
} |
|
1005 |
|
|
1006 |
// 查询之前的记录号 |
|
1007 |
private void findRecordCount() { |
|
1008 |
// 开始查询记录 |
|
1009 |
NetSDKLib.NET_IN_FIND_RECORD_PARAM stuFindInParam = new NetSDKLib.NET_IN_FIND_RECORD_PARAM(); |
|
1010 |
stuFindInParam.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST; |
|
1011 |
NetSDKLib.FIND_RECORD_TRAFFICREDLIST_CONDITION stuRedListCondition = new NetSDKLib.FIND_RECORD_TRAFFICREDLIST_CONDITION(); |
|
1012 |
stuFindInParam.pQueryCondition = stuRedListCondition.getPointer(); |
|
1013 |
// 获取选中行的车牌号,并赋值 |
|
1014 |
int row = table.getSelectedRow(); |
|
1015 |
try { |
|
1016 |
System.arraycopy(String.valueOf(model.getValueAt(row, 1)).getBytes("GBK"), 0, stuRedListCondition.szPlateNumber, |
|
1017 |
0, String.valueOf(model.getValueAt(row, 1)).getBytes("GBK").length); |
|
1018 |
} catch (UnsupportedEncodingException e) { |
|
1019 |
e.printStackTrace(); |
|
1020 |
} |
|
1021 |
|
|
1022 |
NetSDKLib.NET_OUT_FIND_RECORD_PARAM stuFindOutParam = new NetSDKLib.NET_OUT_FIND_RECORD_PARAM(); |
|
1023 |
|
|
1024 |
stuFindInParam.write(); |
|
1025 |
stuRedListCondition.write(); |
|
1026 |
boolean bRet = NetSdk.CLIENT_FindRecord(m_hLoginHandle, stuFindInParam, stuFindOutParam, 5000); |
|
1027 |
stuRedListCondition.read(); |
|
1028 |
stuFindInParam.read(); |
|
1029 |
|
|
1030 |
if(bRet){ |
|
1031 |
int nRecordCount = 1; |
|
1032 |
|
|
1033 |
NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM stuFindNextInParam = new NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM(); |
|
1034 |
stuFindNextInParam.lFindeHandle = stuFindOutParam.lFindeHandle; |
|
1035 |
stuFindNextInParam.nFileCount = nRecordCount; //想查询的记录条数 |
|
1036 |
|
|
1037 |
NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM stuFindNextOutParam = new NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM(); |
|
1038 |
stuFindNextOutParam.nMaxRecordNum = nRecordCount; |
|
1039 |
NetSDKLib.NET_TRAFFIC_LIST_RECORD pstRecord = new NetSDKLib.NET_TRAFFIC_LIST_RECORD(); |
|
1040 |
stuFindNextOutParam.pRecordList = pstRecord.getPointer(); |
|
1041 |
|
|
1042 |
stuFindNextInParam.write(); |
|
1043 |
stuFindNextOutParam.write(); |
|
1044 |
pstRecord.write(); |
|
1045 |
boolean zRet = NetSdk.CLIENT_FindNextRecord(stuFindNextInParam, stuFindNextOutParam, 5000); |
|
1046 |
pstRecord.read(); |
|
1047 |
stuFindNextInParam.read(); |
|
1048 |
stuFindNextOutParam.read(); |
|
1049 |
|
|
1050 |
if(zRet) { |
|
1051 |
// 获取当前记录号 |
|
1052 |
nNo = pstRecord.nRecordNo; |
|
1053 |
} |
|
1054 |
// 停止查询 |
|
1055 |
NetSdk.CLIENT_FindRecordClose(stuFindOutParam.lFindeHandle); |
|
1056 |
} else { |
|
1057 |
System.err.println("error occured!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1058 |
} |
|
1059 |
} |
|
1060 |
|
|
1061 |
// 删除按钮事件 |
|
1062 |
private void deleteOperate() { |
|
1063 |
|
|
1064 |
findRecordCount(); |
|
1065 |
|
|
1066 |
// 获得之前查询到的记录号后,开始删除数据 |
|
1067 |
NetSDKLib.NET_REMOVE_RECORD_INFO stRemoveInfo = new NetSDKLib.NET_REMOVE_RECORD_INFO(); |
|
1068 |
|
|
1069 |
stRemoveInfo.nRecordNo = nNo; |
|
1070 |
System.out.println("nNo:"+nNo); |
|
1071 |
NetSDKLib.NET_IN_OPERATE_TRAFFIC_LIST_RECORD stInParam = new NetSDKLib.NET_IN_OPERATE_TRAFFIC_LIST_RECORD(); |
|
1072 |
stInParam.emOperateType = NetSDKLib.EM_RECORD_OPERATE_TYPE.NET_TRAFFIC_LIST_REMOVE; |
|
1073 |
stInParam.emRecordType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST;; |
|
1074 |
stInParam.pstOpreateInfo = stRemoveInfo.getPointer(); |
|
1075 |
NetSDKLib.NET_OUT_OPERATE_TRAFFIC_LIST_RECORD stOutParam = new NetSDKLib.NET_OUT_OPERATE_TRAFFIC_LIST_RECORD(); |
|
1076 |
|
|
1077 |
stInParam.write(); |
|
1078 |
stRemoveInfo.write(); |
|
1079 |
boolean zRet = NetSdk.CLIENT_OperateTrafficList(m_hLoginHandle, stInParam, stOutParam, 5000); |
|
1080 |
|
|
1081 |
if(zRet) { |
|
1082 |
System.out.println("delete succeed!"); |
|
1083 |
JOptionPane.showMessageDialog(this, Res.string().getDeleteSuccess()); |
|
1084 |
} else { |
|
1085 |
JOptionPane.showMessageDialog(this, Res.string().getDeleteFail()); |
|
1086 |
System.err.println("failed!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1087 |
} |
|
1088 |
} |
|
1089 |
|
|
1090 |
// 修改按钮事件 |
|
1091 |
private void modifyOperate() { |
|
1092 |
|
|
1093 |
|
|
1094 |
findRecordCount(); |
|
1095 |
|
|
1096 |
NetSDKLib.NET_TRAFFIC_LIST_RECORD.ByReference stRec = new NetSDKLib.NET_TRAFFIC_LIST_RECORD.ByReference(); |
|
1097 |
try { |
|
1098 |
|
|
1099 |
stRec.szPlateNumber = nullTextArea31.getText().getBytes("GBK"); |
|
1100 |
stRec.szMasterOfCar = nullTextArea41.getText().getBytes("GBK"); |
|
1101 |
|
|
1102 |
if( stRec.szPlateNumber.length>NET_MAX_PLATE_NUMBER_LEN-1){ |
|
1103 |
JOptionPane.showMessageDialog(this, Res.string().getLicensePlateLengthTooLong()); |
|
1104 |
return; |
|
1105 |
} |
|
1106 |
|
|
1107 |
|
|
1108 |
if(stRec.szMasterOfCar.length>NET_MAX_NAME_LEN){ |
|
1109 |
JOptionPane.showMessageDialog(this, Res.string().getNameTooLong()); |
|
1110 |
return; |
|
1111 |
} |
|
1112 |
} catch (UnsupportedEncodingException e) { |
|
1113 |
System.err.println("字符串转码异常"); |
|
1114 |
} |
|
1115 |
|
|
1116 |
|
|
1117 |
|
|
1118 |
String[] start = startTextArea1.getText().split(" "); |
|
1119 |
String st1 = start[0]; |
|
1120 |
String st2 = start[1]; |
|
1121 |
String[] start1 = st1.split("/"); //年月日 |
|
1122 |
String[] start2 = st2.split(":"); // 时分 |
|
1123 |
String[] end = endTextArea1.getText().split(" "); |
|
1124 |
String ed1 = end[0]; |
|
1125 |
String ed2 = end[1]; |
|
1126 |
String[] end1 = ed1.split("/"); //年月日 |
|
1127 |
String[] end2 = ed2.split(":"); // 时分 |
|
1128 |
stRec.stBeginTime.dwYear = Integer.parseInt(start1[0]); |
|
1129 |
stRec.stBeginTime.dwMonth = Integer.parseInt(start1[1]); |
|
1130 |
stRec.stBeginTime.dwDay = Integer.parseInt(start1[2]); |
|
1131 |
stRec.stBeginTime.dwHour = Integer.parseInt(start2[0]); |
|
1132 |
stRec.stBeginTime.dwMinute = Integer.parseInt(start2[1]); |
|
1133 |
stRec.stBeginTime.dwSecond = Integer.parseInt(start2[2]); |
|
1134 |
stRec.stCancelTime.dwYear = Integer.parseInt(end1[0]); |
|
1135 |
stRec.stCancelTime.dwMonth = Integer.parseInt(end1[1]); |
|
1136 |
stRec.stCancelTime.dwDay = Integer.parseInt(end1[2]); |
|
1137 |
stRec.stCancelTime.dwHour = Integer.parseInt(end2[0]); |
|
1138 |
stRec.stCancelTime.dwMinute = Integer.parseInt(end2[1]); |
|
1139 |
stRec.stCancelTime.dwSecond = Integer.parseInt(end2[2]); |
|
1140 |
stRec.nAuthrityNum = 1; |
|
1141 |
stRec.stAuthrityTypes[0].emAuthorityType = pstRecordAdd.stAuthrityTypes[0].emAuthorityType; |
|
1142 |
stRec.stAuthrityTypes[0].bAuthorityEnable = pstRecordAdd.stAuthrityTypes[0].bAuthorityEnable; |
|
1143 |
|
|
1144 |
stRec.nRecordNo = nNo; |
|
1145 |
|
|
1146 |
NetSDKLib.NET_UPDATE_RECORD_INFO stUpdateInfo = new NetSDKLib.NET_UPDATE_RECORD_INFO(); |
|
1147 |
stUpdateInfo.pRecordInfo = stRec; |
|
1148 |
|
|
1149 |
NetSDKLib.NET_IN_OPERATE_TRAFFIC_LIST_RECORD stInParam = new NetSDKLib.NET_IN_OPERATE_TRAFFIC_LIST_RECORD(); |
|
1150 |
stInParam.emOperateType = NetSDKLib.EM_RECORD_OPERATE_TYPE.NET_TRAFFIC_LIST_UPDATE; |
|
1151 |
stInParam.emRecordType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST; |
|
1152 |
stInParam.pstOpreateInfo = stUpdateInfo.getPointer(); |
|
1153 |
NetSDKLib.NET_OUT_OPERATE_TRAFFIC_LIST_RECORD stOutParam = new NetSDKLib.NET_OUT_OPERATE_TRAFFIC_LIST_RECORD(); |
|
1154 |
|
|
1155 |
stRec.write(); |
|
1156 |
stUpdateInfo.write(); |
|
1157 |
stInParam.write(); |
|
1158 |
boolean zRet = NetSdk.CLIENT_OperateTrafficList(m_hLoginHandle, stInParam, stOutParam, 5000); |
|
1159 |
if(zRet) { |
|
1160 |
System.out.println("succeed!"); |
|
1161 |
System.out.println("stOutParam:"+stOutParam.nRecordNo); |
|
1162 |
JOptionPane.showMessageDialog(this, Res.string().getModifySuccess()); |
|
1163 |
} else { |
|
1164 |
JOptionPane.showMessageDialog(this, Res.string().getModifyFail()); |
|
1165 |
|
|
1166 |
System.err.println("failed!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1167 |
} |
|
1168 |
} |
|
1169 |
|
|
1170 |
// 全部删除 |
|
1171 |
private void alldeleteOperate() { |
|
1172 |
int type = NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_CLEAR; |
|
1173 |
NetSDKLib.NET_CTRL_RECORDSET_PARAM param = new NetSDKLib.NET_CTRL_RECORDSET_PARAM(); |
|
1174 |
param.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST; |
|
1175 |
param.write(); |
|
1176 |
boolean zRet = NetSdk.CLIENT_ControlDevice(m_hLoginHandle, type, param.getPointer(), 5000); |
|
1177 |
if(zRet) { |
|
1178 |
System.out.println("全部删除成功"); |
|
1179 |
JOptionPane.showMessageDialog(this, Res.string().getDeleteSuccess()); |
|
1180 |
} else { |
|
1181 |
System.err.println("全部删除失败"); |
|
1182 |
JOptionPane.showMessageDialog(this, Res.string().getDeleteFail()); |
|
1183 |
} |
|
1184 |
} |
|
1185 |
|
|
1186 |
// 上传按钮事件 注:上传*.CSV的文件,文件的数据会覆盖原数据库的数据,所以可以从数据库导出文件,并在文件里添加数据后,再上传 |
|
1187 |
private void upLoad() { |
|
1188 |
|
|
1189 |
|
|
1190 |
JOptionPane jOptionPane=new JOptionPane(); |
|
1191 |
|
|
1192 |
NetSDKLib.NETDEV_BLACKWHITE_LIST_INFO stIn = new NetSDKLib.NETDEV_BLACKWHITE_LIST_INFO(); |
|
1193 |
Pointer szInBuf = stIn.getPointer(); |
|
1194 |
int nInBufLen = stIn.size(); |
|
1195 |
try { |
|
1196 |
stIn.szFile = jfc.getSelectedFile().getAbsolutePath().getBytes("GBK"); |
|
1197 |
} catch (UnsupportedEncodingException e) { |
|
1198 |
e.printStackTrace(); |
|
1199 |
} |
|
1200 |
stIn.nFileSize = 1024*1024*3; // 升级文件大小 |
|
1201 |
stIn.byFileType = 1; //当前文件类型,0-禁止名单,1-允许名单 |
|
1202 |
stIn.byAction = 0; //动作,0-覆盖,1-追加 |
|
1203 |
stIn.write(); |
|
1204 |
LLong zRet = NetSdk.CLIENT_FileTransmit(m_hLoginHandle, NetSDKLib.NET_DEV_BLACKWHITETRANS_START, szInBuf, nInBufLen, TransFileCall.getInstance(), null, 5000); |
|
1205 |
|
|
1206 |
|
|
1207 |
stIn.read(); |
|
1208 |
if(zRet.longValue() == 0) { |
|
1209 |
System.err.println("Start failed!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1210 |
|
|
1211 |
String type=Res.string().getUploadFail(); |
|
1212 |
jOptionPane.showMessageDialog( this, type); |
|
1213 |
|
|
1214 |
return; |
|
1215 |
} |
|
1216 |
|
|
1217 |
stIn.write(); |
|
1218 |
LongByReference handleReference = new LongByReference(zRet.longValue()); //LLong转为Pointer* |
|
1219 |
LLong zRet1 = NetSdk.CLIENT_FileTransmit(m_hLoginHandle, NetSDKLib.NET_DEV_BLACKWHITETRANS_SEND, handleReference.getPointer(), nInBufLen, TransFileCall.getInstance(), null, 20000); |
|
1220 |
stIn.read(); |
|
1221 |
if(zRet1.longValue() == 0) { |
|
1222 |
System.err.println("Send failed!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1223 |
|
|
1224 |
String type=Res.string().getUploadFail(); |
|
1225 |
jOptionPane.showMessageDialog( this, type); |
|
1226 |
}else { |
|
1227 |
|
|
1228 |
try { |
|
1229 |
Thread.sleep(1000); |
|
1230 |
} catch (InterruptedException e) { |
|
1231 |
e.printStackTrace(); |
|
1232 |
} |
|
1233 |
stIn.write(); |
|
1234 |
LLong zRet2 = NetSdk.CLIENT_FileTransmit(m_hLoginHandle, NetSDKLib.NET_DEV_BLACKWHITETRANS_STOP, handleReference.getPointer(), nInBufLen, TransFileCall.getInstance(), null, 5000); |
|
1235 |
stIn.read(); |
|
1236 |
if(zRet2.longValue() == 0) { |
|
1237 |
|
|
1238 |
System.err.println("Stop failed!" + String.format("0x%x", NetSdk.CLIENT_GetLastError())); |
|
1239 |
String type=Res.string().getUploadFail(); |
|
1240 |
jOptionPane.showMessageDialog( this, type); |
|
1241 |
} else { |
|
1242 |
|
|
1243 |
String type=Res.string().getUploadSuccess(); |
|
1244 |
jOptionPane.showMessageDialog( this, type); |
|
1245 |
} |
|
1246 |
|
|
1247 |
} |
|
1248 |
|
|
1249 |
|
|
1250 |
} |
|
1251 |
|
|
1252 |
private static class TransFileCall implements NetSDKLib.fTransFileCallBack{ |
|
1253 |
private static TransFileCall instance; |
|
1254 |
public static TransFileCall getInstance() { |
|
1255 |
if (instance == null) { |
|
1256 |
instance = new TransFileCall(); |
|
1257 |
} |
|
1258 |
return instance; |
|
1259 |
} |
|
1260 |
|
|
1261 |
|
|
1262 |
@Override |
|
1263 |
public void invoke(LLong lHandle, int nTransType, int nState, int nSendSize, int nTotalSize, Pointer dwUser) { |
|
1264 |
/* System.out.println("nTransType:"+nTransType); |
|
1265 |
System.out.println("nState:"+nState);*/ |
|
1266 |
} |
|
1267 |
} |
|
1268 |
|
|
1269 |
/////////////////////组件////////////////////////// |
|
1270 |
////////////////////////////////////////////////// |
|
1271 |
|
|
1272 |
//登录组件 |
|
1273 |
private LoginPanel loginPanel; |
|
1274 |
private JButton loginBtn; |
|
1275 |
private JButton logoutBtn; |
|
1276 |
|
|
1277 |
private JLabel numLabel; |
|
1278 |
private JTextField numTextArea; |
|
1279 |
//private JButton queryBtn; |
|
1280 |
private JButton queryExBtn; |
|
1281 |
private JButton addBtn; |
|
1282 |
private JButton deleteBtn; |
|
1283 |
private JButton modifyBtn; |
|
1284 |
|
|
1285 |
private JTextField browseTextArea; |
|
1286 |
private JButton browseBtn; |
|
1287 |
private JLabel nullLabel1; |
|
1288 |
private JButton upLoadBtn; |
|
1289 |
private JLabel nullLabel2; |
|
1290 |
|
|
1291 |
private JComboBox jComboBox; |
|
1292 |
private JLabel numberLabel; |
|
1293 |
private JTextField nullTextArea3; |
|
1294 |
private JLabel userLabel; |
|
1295 |
private JTextField nullTextArea4; |
|
1296 |
private JLabel startTime; |
|
1297 |
private JTextField startTextArea; |
|
1298 |
private JLabel stopTime; |
|
1299 |
private JTextField endTextArea; |
|
1300 |
private JRadioButton jr; |
|
1301 |
private JButton okBtn; |
|
1302 |
private JButton cancleBtn; |
|
1303 |
private JButton alldeleteBtn; |
|
1304 |
|
|
1305 |
private JLabel numberLabel1; |
|
1306 |
private JTextField nullTextArea31; |
|
1307 |
private JLabel userLabel1; |
|
1308 |
private JTextField nullTextArea41; |
|
1309 |
private JLabel startTime1; |
|
1310 |
private JTextField startTextArea1; |
|
1311 |
private JLabel stopTime1; |
|
1312 |
private JTextField endTextArea1; |
|
1313 |
private JRadioButton jr1; |
|
1314 |
private JButton okBtn1; |
|
1315 |
private JButton cancleBtn1; |
|
1316 |
|
|
1317 |
private JFileChooser jfc; |
|
1318 |
private JLabel ipLabel; |
|
1319 |
private JTextField ipTextArea; |
|
1320 |
private JLabel nameLabel; |
|
1321 |
private JLabel passwordLabel; |
|
1322 |
private JLabel portLabel; |
|
1323 |
|
|
1324 |
private JTextField portTextArea; |
|
1325 |
private JTextField nameTextArea; |
|
1326 |
private JPasswordField passwordTextArea; |
|
1327 |
|
|
1328 |
private DefaultTableModel model; |
|
1329 |
private JTable table; |
|
1330 |
private Object[][] data; |
|
1331 |
} |
|
1332 |
|
|
1333 |
|
|
1334 |
public class TrafficAllowList { |
|
1335 |
public static void main(String[] args) { |
|
1336 |
SwingUtilities.invokeLater(new Runnable() { |
|
1337 |
public void run() { |
|
1338 |
JNATrafficListFrame demo = new JNATrafficListFrame(); |
|
1339 |
demo.setVisible(true); |
|
1340 |
} |
|
1341 |
}); |
|
1342 |
} |
|
1343 |
} |
|
1344 |
|