dengzedong
2024-12-19 85b2001c0ec2f1adc598db3bf47ad457dcca7074
提交 | 用户 | 时间
149dd0 1 package com.iailab.netsdk.demo.frame.TargetRecognition;
H 2
3 import com.iailab.netsdk.common.DateChooserJButtonEx;
4 import com.iailab.netsdk.common.FunctionList;
5 import com.iailab.netsdk.common.Res;
6 import com.iailab.netsdk.demo.module.DotmatrixScreenModule;
7 import com.iailab.netsdk.demo.module.LoginModule;
8 import com.iailab.netsdk.lib.NetSDKLib;
9 import com.iailab.netsdk.lib.NetSDKLib.CtrlType;
10 import com.iailab.netsdk.lib.NetSDKLib.LLong;
11 import com.iailab.netsdk.lib.ToolKits;
12 import com.iailab.netsdk.lib.structure.NET_IN_SET_PARK_CONTROL_INFO;
13 import com.iailab.netsdk.lib.structure.NET_OUT_SET_PARK_CONTROL_INFO;
14 import com.sun.jna.Pointer;
15
16 import javax.swing.*;
17 import javax.swing.border.TitledBorder;
18 import javax.swing.table.DefaultTableCellRenderer;
19 import javax.swing.table.DefaultTableModel;
20 import java.awt.*;
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.awt.event.WindowAdapter;
24 import java.awt.event.WindowEvent;
25 import java.io.UnsupportedEncodingException;
26 import java.util.ArrayList;
27 import java.util.List;
28
29 /**
30  * @author 119178 点阵屏下发demo
31  */
32 public class NewLatticeScreen {
33
34     // 设备断线通知回调
35     private DisConnect disConnect = new DisConnect();
36
37     // 网络连接恢复
38     private HaveReConnect haveReConnect = new HaveReConnect();
39     private JFrame frame;
40     private JTextField textField;
41     private JTextField textField_1;
42     private JTextField textField_2;
43     private JPasswordField passwordField;
44
45     private JButton btnNewButton;
46     private JButton btnNewButton_1;
47     private JTabbedPane tabbedPane;
48     private JPanel panel_2;
49     private JLabel label_CarStatus;
50     private JComboBox comboBox_CarStatus;
51     private JLabel label_InTime;
52     private DateChooserJButtonEx dateChooser_InTime;
53     private JLabel label_OutTime;
54     private DateChooserJButtonEx dateChooser_OutTime;
55     private JLabel label_PlateNmuber;
56     private JTextField textField_PlateNumber;
57     private JLabel label_CarOwner;
58     private JTextField textField_CarOwner;
59     private JLabel label_ParkingTime;
60     private JTextField textField_ParkingTime;
61     private JLabel label_UserType;
62     private JComboBox comboBox_UserType;
63     private JLabel label_ParkingCharge;
64     private JTextField textField_ParkingCharge;
65     private JLabel label_DaysDue;
66     private JTextField textField_DaysDue;
67     private JLabel label_RemainParkingSpaces;
68     private JTextField textField_RemainParkingSpaces;
69     private JRadioButton radioButton_Allow2Pass;
70     private JRadioButton radioButton_Deny2Pass;
71     private JButton button;
72     private JLabel label_CustomerUserInfo;
73     private JLabel label_RemarksInfo;
74     private JLabel label_CustomerInfo;
75     private JTextField textField_CustomerUserInfo;
76     private JTextField textField_RemarksInfo;
77     private JTextField textField_CustomerInfo;
78     private JPanel panel_1;
79     private JScrollPane scrollPane;
80     private Object[][] ScreenTableData;
81     private Object[][] VideoTableData;
82     private JTable ScreenTable;
83     private JTable VideoTable;
84     private JPanel ScreenInfo;
85
86     private final String[] ScreenTableTitle = {Res.string().getScreenNumber(), Res.string().getContain(),
87             Res.string().getContainType(), Res.string().getContainColor(), Res.string().getScrollType(),
88             Res.string().getScrollSpeed()};
89
90     private final String[] VideoTableTitle = {Res.string().getScreenNumber(), Res.string().getContain(),
91             Res.string().getContainType()};
92
93     private DefaultTableModel Model;
94     private DefaultTableModel VideoModel;
95     private JLabel label_17;
96
97     private JComboBox comboBox_8;
98     private JComboBox comboBox_4;
99     private JComboBox comboBox_5;
100     private JComboBox comboBox_6;
101     private JComboBox comboBox_7;
102     private JButton btnNewButton_3;
103     private JButton btnNewButton_4;
104     private JButton btnNewButton_5;
105     private JTextField textField_21;
106     private JTextField textField_22;
107     private JTextField textField_23;
108     private JButton button_1;
109     private JButton button_2;
110     private JButton button_4;
111     private JButton btnNewButton_6;
112
113     private JLabel label_19;
114
115     // private static NET_IN_SET_PARK_CONTROL_INFO pIn = new
116     // NET_IN_SET_PARK_CONTROL_INFO();
117
118     /**
119      * Launch the application.
120      */
121     public static void main(String[] args) {
122         SwingUtilities.invokeLater(new Runnable() {
123             public void run() {
124                 NewLatticeScreen demo = new NewLatticeScreen();
125                 demo.frame.setVisible(true);
126             }
127         });
128     }
129
130     /**
131      * Create the application.
132      */
133     public NewLatticeScreen() {
134         LoginModule.init(disConnect, haveReConnect); // 打开工程,初始化
135         initialize();
136         // 注册窗体清出事件
137         frame.addWindowListener(new WindowAdapter() {
138             public void windowClosing(WindowEvent e) {
139                 LoginModule.logout(); // 退出
140                 LoginModule.cleanup(); // 关闭工程,释放资源
141                 frame.dispose();
142                 // 返回主菜单
143                 SwingUtilities.invokeLater(new Runnable() {
144                     public void run() {
145                         FunctionList demo = new FunctionList();
146                         demo.setVisible(true);
147                     }
148                 });
149             }
150         });
151     }
152
153     /////////////////面板///////////////////
154 // 设备断线回调: 通过 CLIENT_Init 设置该回调函数,当设备出现断线时,SDK会调用该函数
155     private class DisConnect implements NetSDKLib.fDisConnect {
156         public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) {
157             System.out.printf("Device[%s] Port[%d] DisConnect!\n", pchDVRIP, nDVRPort);
158 // 断线提示
159             SwingUtilities.invokeLater(new Runnable() {
160                 public void run() {
161                     frame.setTitle(
162                             Res.string().getTargetRecognition() + " : " + Res.string().getDisConnectReconnecting());
163                 }
164             });
165         }
166     }
167
168     // 网络连接恢复,设备重连成功回调
169 // 通过 CLIENT_SetAutoReconnect 设置该回调函数,当已断线的设备重连成功时,SDK会调用该函数
170     private class HaveReConnect implements NetSDKLib.fHaveReConnect {
171         public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) {
172             System.out.printf("ReConnect Device[%s] Port[%d]\n", pchDVRIP, nDVRPort);
173
174 // 重连提示
175             SwingUtilities.invokeLater(new Runnable() {
176                 public void run() {
177                     frame.setTitle(Res.string().getTargetRecognition() + " : " + Res.string().getOnline());
178                 }
179             });
180         }
181     }
182
183     /**
184      * Initialize the contents of the frame.
185      */
186     private void initialize() {
187         frame = new JFrame();
188         frame.setTitle(Res.string().getmatrixScreen());
189         frame.setBounds(200, 200, 807, 578);
190         // frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
191         frame.getContentPane().setLayout(null);
192         try {
193             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
194         } catch (Exception e) {
195             e.printStackTrace();
196         }
197
198         final JPanel panel1 = new JPanel();
199         panel1.setBounds(10, 10, 100, 50);
200
201         JPanel panel = new JPanel();
202         panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), Res.string().getLogin(),
203                 TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
204         panel.setBounds(10, 10, 771, 40);
205         frame.getContentPane().add(panel);
206         panel.setLayout(null);
207
208         JLabel lblNewLabel = new JLabel(Res.string().getDeviceIp() + ":");
209         lblNewLabel.setBounds(26, 14, 54, 15);
210         panel.add(lblNewLabel);
211
212         textField = new JTextField("172.23.11.180");
213         textField.setBounds(82, 11, 76, 21);
214         panel.add(textField);
215         textField.setColumns(10);
216
217         JLabel lblNewLabel_1 = new JLabel(Res.string().getPort() + ":");
218         lblNewLabel_1.setBounds(168, 14, 47, 15);
219         panel.add(lblNewLabel_1);
220
221         textField_1 = new JTextField("37777");
222         textField_1.setBounds(217, 11, 76, 21);
223         panel.add(textField_1);
224         textField_1.setColumns(10);
225
226         JLabel lblNewLabel_2 = new JLabel(Res.string().getUserName() + ":");
227         lblNewLabel_2.setBounds(302, 14, 47, 15);
228         panel.add(lblNewLabel_2);
229
230         textField_2 = new JTextField("admin");
231         textField_2.setBounds(351, 11, 76, 21);
232         panel.add(textField_2);
233         textField_2.setColumns(10);
234
235         JLabel lblNewLabel_3 = new JLabel(Res.string().getPassword() + ":");
236         lblNewLabel_3.setBounds(435, 14, 38, 15);
237         panel.add(lblNewLabel_3);
238
239         passwordField = new JPasswordField("admin123");
240         passwordField.setBounds(476, 11, 89, 21);
241         panel.add(passwordField);
242
243         btnNewButton = new JButton(Res.string().getLogin());
244         btnNewButton.addActionListener(new ActionListener() {
245             public void actionPerformed(ActionEvent e) {
246                 if (LoginModule.login(textField.getText(), Integer.parseInt(textField_1.getText()),
247                         textField_2.getText(), new String(passwordField.getPassword()))) {
248                     btnNewButton.setEnabled(false);
249                     btnNewButton_1.setEnabled(true);
250                     button.setEnabled(true);
251
252                     comboBox_8.setEnabled(true);
253                     ;
254                     comboBox_4.setEnabled(true);
255                     comboBox_5.setEnabled(true);
256                     comboBox_6.setEnabled(true);
257                     comboBox_7.setEnabled(true);
258                     btnNewButton_3.setEnabled(true);
259                     btnNewButton_4.setEnabled(true);
260                     btnNewButton_5.setEnabled(true);
261                     textField_21.setEnabled(true);
262                     textField_22.setEnabled(true);
263                     textField_23.setEnabled(true);
264                     button_1.setEnabled(true);
265                     button_2.setEnabled(true);
266                     button_4.setEnabled(true);
267                     btnNewButton_6.setEnabled(true);
268
269                     textField.setEnabled(true);
270                     ;
271                     textField_1.setEditable(true);
272                     ;
273                     textField_2.setEnabled(true);
274                     textField_CustomerInfo.setEnabled(true);
275                     textField_RemarksInfo.setEnabled(true);
276                     textField_CustomerUserInfo.setEnabled(true);
277                     textField_RemainParkingSpaces.setEnabled(true);
278                     textField_DaysDue.setEnabled(true);
279                     textField_ParkingCharge.setEnabled(true);
280                     textField_ParkingTime.setEnabled(true);
281                     textField_CarOwner.setEnabled(true);
282                     textField_PlateNumber.setEnabled(true);
283                     comboBox_UserType.setEnabled(true);
284                     comboBox_CarStatus.setEnabled(true);
285                     radioButton_Allow2Pass.setEnabled(true);
286                     radioButton_Deny2Pass.setEnabled(true);
287                     dateChooser_InTime.setEnabled(true);
288                     dateChooser_OutTime.setEnabled(true);
289                     passwordField.setEnabled(true);
290                 } else {
291                     JOptionPane.showMessageDialog(null,
292                             Res.string().getLoginFailed() + ", " + ToolKits.getErrorCodeShow(),
293                             Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
294                 }
295             }
296         });
297         btnNewButton.setBounds(584, 10, 76, 23);
298         panel.add(btnNewButton);
299         btnNewButton.setEnabled(true);
300
301         btnNewButton_1 = new JButton(Res.string().getLogout());
302         btnNewButton_1.addActionListener(new ActionListener() {
303             public void actionPerformed(ActionEvent e) {
304                 LoginModule.logout();
305                 btnNewButton.setEnabled(true);
306                 btnNewButton_1.setEnabled(false);
307                 button.setEnabled(false);
308
309                 comboBox_8.setEnabled(false);
310                 ;
311                 comboBox_4.setEnabled(false);
312                 comboBox_5.setEnabled(false);
313                 comboBox_6.setEnabled(false);
314                 comboBox_7.setEnabled(false);
315                 btnNewButton_3.setEnabled(false);
316                 btnNewButton_4.setEnabled(false);
317                 btnNewButton_5.setEnabled(false);
318                 textField_21.setEnabled(false);
319                 textField_22.setEnabled(false);
320                 textField_23.setEnabled(false);
321                 button_1.setEnabled(false);
322                 button_2.setEnabled(false);
323                 button_4.setEnabled(false);
324                 btnNewButton_6.setEnabled(false);
325
326                 textField.setEnabled(false);
327                 ;
328                 textField_1.setEditable(false);
329                 ;
330                 textField_2.setEnabled(false);
331                 textField_CustomerInfo.setEnabled(false);
332                 textField_RemarksInfo.setEnabled(false);
333                 textField_CustomerUserInfo.setEnabled(false);
334                 textField_RemainParkingSpaces.setEnabled(false);
335                 textField_DaysDue.setEnabled(false);
336                 textField_ParkingCharge.setEnabled(false);
337                 textField_ParkingTime.setEnabled(false);
338                 textField_CarOwner.setEnabled(false);
339                 textField_PlateNumber.setEnabled(false);
340                 comboBox_UserType.setEnabled(false);
341                 comboBox_CarStatus.setEnabled(false);
342                 radioButton_Allow2Pass.setEnabled(false);
343                 radioButton_Deny2Pass.setEnabled(false);
344                 dateChooser_InTime.setEnabled(false);
345                 dateChooser_OutTime.setEnabled(false);
346                 passwordField.setEnabled(true);
347             }
348         });
349         btnNewButton_1.setBounds(678, 10, 76, 23);
350         panel.add(btnNewButton_1);
351         btnNewButton_1.setEnabled(false);
352
353         tabbedPane = new JTabbedPane(JTabbedPane.TOP);
354         tabbedPane.setBounds(10, 60, 771, 470);
355         frame.getContentPane().add(tabbedPane);
356
357         panel_2 = new JPanel();
358         panel_2.setLayout(null);
359         panel_2.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
360         tabbedPane.addTab("part1", null, panel_2, null);
361
362         label_CarStatus = new JLabel(Res.string().getPassingState() + ":");
363         label_CarStatus.setBounds(71, 26, 95, 21);
364         panel_2.add(label_CarStatus);
365
366         comboBox_CarStatus = new JComboBox();
367         comboBox_CarStatus.setEnabled(false);
368         comboBox_CarStatus.setModel(
369                 new DefaultComboBoxModel(new String[]{Res.string().getPassingCar(), Res.string().getNoCar()}));
370         comboBox_CarStatus.setBounds(176, 26, 131, 21);
371         comboBox_CarStatus.setSelectedIndex(0);
372         panel_2.add(comboBox_CarStatus);
373
374         label_InTime = new JLabel(Res.string().getInTime() + ":");
375         label_InTime.setBounds(391, 29, 102, 15);
376         panel_2.add(label_InTime);
377
378         dateChooser_InTime = new DateChooserJButtonEx();
379         dateChooser_InTime.setEnabled(false);
380         dateChooser_InTime.setBounds(503, 26, 131, 21);
381         panel_2.add(dateChooser_InTime);
382
383         label_OutTime = new JLabel(Res.string().getOutTime() + ":");
384         label_OutTime.setBounds(391, 84, 102, 15);
385         panel_2.add(label_OutTime);
386
387         dateChooser_OutTime = new DateChooserJButtonEx();
388         dateChooser_OutTime.setEnabled(false);
389         dateChooser_OutTime.setBounds(503, 81, 131, 21);
390         panel_2.add(dateChooser_OutTime);
391
392         label_PlateNmuber = new JLabel(Res.string().getPlateNumber() + ":");
393         label_PlateNmuber.setBounds(71, 84, 95, 15);
394         panel_2.add(label_PlateNmuber);
395
396         textField_PlateNumber = new JTextField();
397         textField_PlateNumber.setEnabled(false);
398         textField_PlateNumber.setColumns(10);
399         textField_PlateNumber.setBounds(176, 81, 131, 21);
400         panel_2.add(textField_PlateNumber);
401
402         label_CarOwner = new JLabel(Res.string().getCarOwner() + ":");
403         label_CarOwner.setBounds(77, 142, 89, 15);
404         panel_2.add(label_CarOwner);
405
406         textField_CarOwner = new JTextField();
407         textField_CarOwner.setEnabled(false);
408         textField_CarOwner.setColumns(10);
409         textField_CarOwner.setBounds(176, 139, 131, 21);
410         panel_2.add(textField_CarOwner);
411
412         label_ParkingTime = new JLabel(Res.string().getParkingTime() + ":");
413         label_ParkingTime.setBounds(391, 133, 102, 15);
414         panel_2.add(label_ParkingTime);
415
416         textField_ParkingTime = new JTextField();
417         textField_ParkingTime.setEnabled(false);
418         textField_ParkingTime.setColumns(10);
419         textField_ParkingTime.setBounds(503, 130, 131, 21);
420         panel_2.add(textField_ParkingTime);
421
422         label_UserType = new JLabel(Res.string().getUserType() + ":");
423         label_UserType.setBounds(71, 198, 95, 15);
424         panel_2.add(label_UserType);
425
426         comboBox_UserType = new JComboBox();
427         comboBox_UserType.setEnabled(false);
428         comboBox_UserType.setModel(new DefaultComboBoxModel(new String[]{Res.string().getMonthlyCardUser(),
429                 Res.string().getAnnualCardUser(), Res.string().getLongTermUser(), Res.string().getTemporaryUser()}));
430         comboBox_UserType.setBounds(176, 195, 131, 21);
431         comboBox_UserType.setSelectedIndex(0);
432         panel_2.add(comboBox_UserType);
433
434         label_ParkingCharge = new JLabel(Res.string().getParkingCharge());
435         label_ParkingCharge.setBounds(391, 178, 102, 15);
436         panel_2.add(label_ParkingCharge);
437
438         textField_ParkingCharge = new JTextField();
439         textField_ParkingCharge.setEnabled(false);
440         textField_ParkingCharge.setColumns(10);
441         textField_ParkingCharge.setBounds(503, 175, 131, 21);
442         panel_2.add(textField_ParkingCharge);
443
444         label_DaysDue = new JLabel(Res.string().getDaysDue());
445         label_DaysDue.setBounds(71, 253, 95, 15);
446         panel_2.add(label_DaysDue);
447
448         textField_DaysDue = new JTextField();
449         textField_DaysDue.setEnabled(false);
450         textField_DaysDue.setColumns(10);
451         textField_DaysDue.setBounds(176, 250, 131, 21);
452         panel_2.add(textField_DaysDue);
453
454         label_RemainParkingSpaces = new JLabel(Res.string().getRemainingParkingSpaces());
455         label_RemainParkingSpaces.setBounds(391, 215, 102, 15);
456         panel_2.add(label_RemainParkingSpaces);
457
458         textField_RemainParkingSpaces = new JTextField();
459         textField_RemainParkingSpaces.setEnabled(false);
460         textField_RemainParkingSpaces.setColumns(10);
461         textField_RemainParkingSpaces.setBounds(503, 212, 131, 21);
462         panel_2.add(textField_RemainParkingSpaces);
463
464         radioButton_Deny2Pass = new JRadioButton(Res.string().getVehiclesNotAllowedToPass());
465         radioButton_Deny2Pass.setEnabled(false);
466         radioButton_Deny2Pass.setBounds(367, 249, 155, 23);
467         radioButton_Deny2Pass.setSelected(true);
468         panel_2.add(radioButton_Deny2Pass);
469
470         radioButton_Allow2Pass = new JRadioButton(Res.string().getAllowedVehiclesToPass());
471         radioButton_Allow2Pass.setEnabled(false);
472         radioButton_Allow2Pass.setBounds(524, 249, 162, 23);
473         panel_2.add(radioButton_Allow2Pass);
474
475         ButtonGroup group = new ButtonGroup();
476         group.add(radioButton_Allow2Pass);
477         group.add(radioButton_Deny2Pass);
478
479         button = new JButton(Res.string().getSetUp());
480         button.setEnabled(false);
481         button.setBounds(633, 408, 93, 23);
482         panel_2.add(button);
483
484         label_CustomerUserInfo = new JLabel(Res.string().getCostomUserInfo() + ":");
485         label_CustomerUserInfo.setBounds(58, 290, 119, 21);
486         panel_2.add(label_CustomerUserInfo);
487
488         label_RemarksInfo = new JLabel(Res.string().getRemarksInfo() + ":");
489         label_RemarksInfo.setBounds(58, 332, 97, 21);
490         panel_2.add(label_RemarksInfo);
491
492         label_CustomerInfo = new JLabel(Res.string().getCostomInfo() + ":");
493         label_CustomerInfo.setBounds(58, 375, 95, 21);
494         panel_2.add(label_CustomerInfo);
495
496         textField_CustomerUserInfo = new JTextField();
497         textField_CustomerUserInfo.setEnabled(false);
498         textField_CustomerUserInfo.setColumns(10);
499         textField_CustomerUserInfo.setBounds(176, 287, 460, 28);
500         panel_2.add(textField_CustomerUserInfo);
501
502         textField_RemarksInfo = new JTextField();
503         textField_RemarksInfo.setEnabled(false);
504         textField_RemarksInfo.setColumns(10);
505         textField_RemarksInfo.setBounds(176, 329, 460, 28);
506         panel_2.add(textField_RemarksInfo);
507
508         textField_CustomerInfo = new JTextField();
509         textField_CustomerInfo.setEnabled(false);
510         textField_CustomerInfo.setColumns(10);
511         textField_CustomerInfo.setBounds(176, 372, 460, 28);
512         panel_2.add(textField_CustomerInfo);
513
514         button.addActionListener(new ActionListener() {
515             public void actionPerformed(ActionEvent e) {
516                 int emType = NetSDKLib.CtrlType.CTRLTYPE_CTRL_SET_PARK_INFO;
517
518                 NetSDKLib.NET_CTRL_SET_PARK_INFO msg = new NetSDKLib.NET_CTRL_SET_PARK_INFO();
519
520                 try {
521                     byte[] plateNumber = textField_PlateNumber.getText().getBytes("GBK");
522                     System.arraycopy(plateNumber, 0, msg.szPlateNumber, 0, plateNumber.length);
523                 } catch (UnsupportedEncodingException e2) {
524                     // TODO Auto-generated catch block
525                     e2.printStackTrace();
526                 }
527
528                 if (!textField_ParkingTime.getText().equals("")) {
529                     msg.nParkTime = Integer.parseInt(textField_ParkingTime.getText());
530                 } else {
531                     msg.nParkTime = 0;
532                 }
533
534                 try {
535                     byte[] masterOfCar = textField_CarOwner.getText().getBytes("GBK");
536                     System.arraycopy(masterOfCar, 0, msg.szMasterofCar, 0, masterOfCar.length);
537                 } catch (UnsupportedEncodingException e2) {
538                     // TODO Auto-generated catch block
539                     e2.printStackTrace();
540                 }
541
542                 if (comboBox_UserType.getSelectedItem() != null) {
543                     if (comboBox_UserType.getSelectedItem().equals(Res.string().getMonthlyCardUser())) {
544                         System.arraycopy("monthlyCardUser".getBytes(), 0, msg.szUserType, 0, "monthlyCardUser".length());
545                     } else if (comboBox_UserType.getSelectedItem().equals(Res.string().getAnnualCardUser())) {
546                         System.arraycopy("yearlyCardUser".getBytes(), 0, msg.szUserType, 0, "yearlyCardUser".length());
547                     } else if (comboBox_UserType.getSelectedItem().equals(Res.string().getLongTermUser())) {
548                         System.arraycopy("longTimeUser".getBytes(), 0, msg.szUserType, 0, "longTimeUser".length());
549                     } else if (comboBox_UserType.getSelectedItem().equals(Res.string().getTemporaryUser())) {
550                         System.arraycopy("casualUser".getBytes(), 0, msg.szUserType, 0, "casualUser".length());
551                     }
552                 }
553
554                 if (!textField_DaysDue.getText().equals("")) {
555                     msg.nRemainDay = Integer.parseInt(textField_DaysDue.getText());
556                 } else {
557                     msg.nRemainDay = 0;
558                 }
559
560                 if (radioButton_Deny2Pass.isSelected()) {
561                     msg.nPassEnable = 0;
562                 } else if (radioButton_Allow2Pass.isSelected()) {
563                     msg.nPassEnable = 1;
564                 }
565                 String InTime = dateChooser_InTime.getText();// 车辆入场时间
566                 String[] InTimes = InTime.split("-");
567
568                 msg.stuInTime.dwYear = (short) Integer.parseInt(InTimes[0]);
569                 msg.stuInTime.dwMonth = (byte) Integer.parseInt(InTimes[1]);
570                 msg.stuInTime.dwDay = (byte) Integer.parseInt(InTimes[2]);
571
572                 String OutTime = dateChooser_OutTime.getText();// 车辆出场时间
573                 String[] OutTimes = OutTime.split("-");
574
575                 msg.stuOutTime.dwYear = (short) Integer.parseInt(OutTimes[0]);
576                 msg.stuOutTime.dwMonth = (byte) Integer.parseInt(OutTimes[1]);
577                 msg.stuOutTime.dwDay = (byte) Integer.parseInt(OutTimes[2]);
578
579                 try {
580                     byte[] parkCharge = textField_ParkingCharge.getText().getBytes("GBK");
581                     System.arraycopy(parkCharge, 0, msg.szParkCharge, 0, parkCharge.length);
582                 } catch (UnsupportedEncodingException e2) {
583                     // TODO Auto-generated catch block
584                     e2.printStackTrace();
585                 }
586
587                 if (!textField_RemainParkingSpaces.getText().equals("")) {
588                     msg.nRemainSpace = Integer.parseInt(textField_RemainParkingSpaces.getText());
589                 } else {
590                     msg.nRemainSpace = 0;
591                 }
592
593                 if (comboBox_CarStatus.getSelectedItem() != null) {
594                     if (comboBox_CarStatus.getSelectedItem().equals(Res.string().getPassingCar())) {
595                         msg.emCarStatus = 1;
596                     } else if (comboBox_CarStatus.getSelectedItem().equals(Res.string().getNoCar())) {
597                         msg.emCarStatus = 2;
598                     }
599                 }
600
601                 try {
602                     byte[] subUserType = textField_CustomerUserInfo.getText().getBytes("GBK");
603                     System.arraycopy(subUserType, 0, msg.szSubUserType, 0, subUserType.length);
604                 } catch (UnsupportedEncodingException e1) {
605                     // TODO Auto-generated catch block
606                     e1.printStackTrace();
607                 }
608                 try {
609                     byte[] remarks = textField_RemarksInfo.getText().getBytes("GBK");
610                     System.arraycopy(remarks, 0, msg.szRemarks, 0, remarks.length);
611                 } catch (UnsupportedEncodingException e1) {
612                     // TODO Auto-generated catch block
613                     e1.printStackTrace();
614                 }
615                 try {
616                     byte[] custom = textField_CustomerInfo.getText().getBytes("GBK");
617                     System.arraycopy(custom, 0, msg.szCustom, 0, custom.length);
618                 } catch (UnsupportedEncodingException e1) {
619                     // TODO Auto-generated catch block
620                     e1.printStackTrace();
621                 }
622
623                 msg.write();
624                 boolean ret = DotmatrixScreenModule.setDotmatrixScreen(emType, msg);
625                 if (ret) {
626                     JOptionPane.showMessageDialog(panel1, Res.string().getSetUpSuccess());
627                 } else {
628                     JOptionPane.showMessageDialog(panel1, Res.string().getSetUpFailed());
629                 }
630             }
631         });
632
633         panel_1 = new JPanel();
634         tabbedPane.addTab("part2", null, panel_1, null);
635         panel_1.setLayout(null);
636         ScreenInfo = new JPanel();
637         ScreenInfo.setBorder(
638                 new TitledBorder(null, Res.string().getEventInfo(), TitledBorder.LEFT, TitledBorder.TOP, null, null));
639         ScreenInfo.setSize(500, 405);
640         ScreenInfo.setLocation(10, 5);
641         panel_1.add(ScreenInfo);
642         ScreenInfo.setLayout(null);
643
644         ScreenTableData = new Object[0][6];
645         ScreenTable = tableInit(ScreenTableData, ScreenTableTitle);
646         Model = (DefaultTableModel) ScreenTable.getModel();
647         scrollPane = new JScrollPane(ScreenTable);
648         scrollPane.setBounds(10, 19, 480, 221);
649         scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
650         ScreenInfo.add(scrollPane);
651
652         btnNewButton_3 = new JButton(Res.string().getAdd());
653         btnNewButton_3.setEnabled(false);
654         btnNewButton_3.setBounds(10, 250, 75, 20);
655         btnNewButton_3.addActionListener(new ActionListener() {
656
657             @Override
658             public void actionPerformed(ActionEvent arg0) {
659                 // TODO Auto-generated method stub
660
661                 String Contain = textField_21.getText();
662                 int ScreenNum = Integer.parseInt(textField_22.getText());
663                 String ContainType = null;
664                 String ContainColor = null;
665                 String ScrollType = null;
666                 String ScrollSpeed = null;
667                 if (comboBox_4.getSelectedItem().equals(Res.string().getOrdinary())) {
668                     ContainType = /* "普通" */Res.string().getOrdinary();
669                 } else if (comboBox_4.getSelectedItem().equals(Res.string().getLocalTime())) {
670                     ContainType = /* "本地时间" */Res.string().getLocalTime();
671                 } else if (comboBox_4.getSelectedItem().equals(Res.string().getQRCode())) {
672                     ContainType = /* "二维码" */Res.string().getQRCode();
673                 } /*
674                  * else if(comboBox_4.getSelectedItem().equals(Res.string().getResource())) {
675                  * ContainType = "资源文件" Res.string().getResource(); }
676                  */
677
678                 if (comboBox_5.getSelectedItem().equals(Res.string().getGreen())) {
679                     ContainColor = /* "绿色" */Res.string().getGreen();
680                 } else if (comboBox_5.getSelectedItem().equals(Res.string().getRed())) {
681                     ContainColor = /* "红色" */Res.string().getRed();
682                 } else if (comboBox_5.getSelectedItem().equals(Res.string().getYellow())) {
683                     ContainColor = /* "黄色" */Res.string().getYellow();
684                 } else if (comboBox_5.getSelectedItem().equals(Res.string().getWhite())) {
685                     ContainColor = /* "白色" */Res.string().getWhite();
686                 }
687                 if (comboBox_6.getSelectedItem().equals(Res.string().getNoRolling())) {
688                     ScrollType = /* "不滚动" */Res.string().getNoRolling();
689                 } else if (comboBox_6.getSelectedItem().equals(Res.string().getScrollLeftAndRight())) {
690                     ScrollType = /* "左右滚动" */Res.string().getScrollLeftAndRight();
691                 } else if (comboBox_6.getSelectedItem().equals(Res.string().getScrollTopAndDown())) {
692                     ScrollType = /* "上下翻页滚动" */Res.string().getScrollTopAndDown();
693                 }
694                 if (comboBox_7.getSelectedItem().equals("1")) {
695                     ScrollSpeed = /* "速率1" */Res.string().getSpeed() + "1";
696                 } else if (comboBox_7.getSelectedItem().equals("2")) {
697                     ScrollSpeed = /* "速率2" */Res.string().getSpeed() + "2";
698                 } else if (comboBox_7.getSelectedItem().equals("3")) {
699                     ScrollSpeed = /* "速率3" */Res.string().getSpeed() + "3";
700                 } else if (comboBox_7.getSelectedItem().equals("4")) {
701                     ScrollSpeed = /* "速率4" */Res.string().getSpeed() + "4";
702                 } else if (comboBox_7.getSelectedItem().equals("5")) {
703                     ScrollSpeed = /* "速率5" */Res.string().getSpeed() + "5";
704                 }
705                 /*
706                  * Model.setValueAt(ScreenNum, index, 0); Model.setValueAt(Contain, index, 1);
707                  * Model.setValueAt(ContainType, index, 2); Model.setValueAt(ContainColor,
708                  * index, 3); Model.setValueAt(ScrollType, index, 4);
709                  * Model.setValueAt(ScrollSpeed, index, 5); index++;
710                  */
711                 List<Integer> num = new ArrayList<Integer>();
712                 for (int i = 0; i < Model.getRowCount(); i++) {
713                     num.add((Integer) Model.getValueAt(i, 0));
714                 }
715                 if (ScreenNum == -1 || Contain == null) {
716                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
717                 } else {
718                     if (num.contains(ScreenNum)) {
719                         JOptionPane.showMessageDialog(panel1, "屏幕编号已存在,请删除或修改屏幕编号!");
720                     } else {
721                         Model.addRow(new Object[]{ScreenNum, Contain, ContainType, ContainColor, ScrollType,
722                                 ScrollSpeed});
723                     }
724                 }
725             }
726         });
727         ScreenInfo.add(btnNewButton_3);
728
729         btnNewButton_4 = new JButton(Res.string().getModify());
730         btnNewButton_4.setEnabled(false);
731         btnNewButton_4.setBounds(96, 250, 75, 20);
732         btnNewButton_4.addActionListener(new ActionListener() {
733
734             @Override
735             public void actionPerformed(ActionEvent arg0) {
736                 // TODO Auto-generated method stub
737                 String Contain = textField_21.getText();
738                 int ScreenNum = Integer.parseInt(textField_22.getText());
739                 // int ScreenNum = (int)Model.getValueAt(ScreenTable.getSelectedRow(), 0);
740                 String ContainType = null;
741                 String ContainColor = null;
742                 String ScrollType = null;
743                 String ScrollSpeed = null;
744                 if (comboBox_4.getSelectedItem().equals(Res.string().getOrdinary())) {
745                     ContainType = /* "普通" */Res.string().getOrdinary();
746                 } else if (comboBox_4.getSelectedItem().equals(Res.string().getLocalTime())) {
747                     ContainType = /* "本地时间" */Res.string().getLocalTime();
748                 } else if (comboBox_4.getSelectedItem().equals(Res.string().getQRCode())) {
749                     ContainType = /* "二维码" */Res.string().getQRCode();
750                 } /*
751                  * else if (comboBox_4.getSelectedItem().equals(Res.string().getResource())) {
752                  * ContainType = "资源文件" Res.string().getResource(); }
753                  */
754
755                 if (comboBox_5.getSelectedItem().equals(Res.string().getGreen())) {
756                     ContainColor = /* "绿色" */Res.string().getGreen();
757                 } else if (comboBox_5.getSelectedItem().equals(Res.string().getRed())) {
758                     ContainColor = /* "红色" */Res.string().getRed();
759                 } else if (comboBox_5.getSelectedItem().equals(Res.string().getYellow())) {
760                     ContainColor = /* "黄色" */Res.string().getYellow();
761                 } else if (comboBox_5.getSelectedItem().equals(Res.string().getWhite())) {
762                     ContainColor = /* "白色" */Res.string().getWhite();
763                 }
764                 if (comboBox_6.getSelectedItem().equals(Res.string().getNoRolling())) {
765                     ScrollType = /* "不滚动" */Res.string().getNoRolling();
766                 } else if (comboBox_6.getSelectedItem().equals(Res.string().getScrollLeftAndRight())) {
767                     ScrollType = /* "左右滚动" */Res.string().getScrollLeftAndRight();
768                 } else if (comboBox_6.getSelectedItem().equals(Res.string().getScrollTopAndDown())) {
769                     ScrollType = /* "上下翻页滚动" */Res.string().getScrollTopAndDown();
770                 }
771                 if (comboBox_7.getSelectedItem().equals("1")) {
772                     ScrollSpeed = /* "速率1" */Res.string().getSpeed() + "1";
773                 } else if (comboBox_7.getSelectedItem().equals("2")) {
774                     ScrollSpeed = /* "速率2" */Res.string().getSpeed() + "2";
775                 } else if (comboBox_7.getSelectedItem().equals("3")) {
776                     ScrollSpeed = /* "速率3" */Res.string().getSpeed() + "3";
777                 } else if (comboBox_7.getSelectedItem().equals("4")) {
778                     ScrollSpeed = /* "速率4" */Res.string().getSpeed() + "4";
779                 } else if (comboBox_7.getSelectedItem().equals("5")) {
780                     ScrollSpeed = /* "速率5" */Res.string().getSpeed() + "5";
781                 }
782
783                 List<Integer> num = new ArrayList<Integer>();
784                 for (int i = 0; i < Model.getRowCount(); i++) {
785                     num.add((Integer) Model.getValueAt(i, 0));
786                 }
787                 num.remove(ScreenTable.getSelectedRow());
788                 if (Model.getRowCount() == 0) {
789                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
790                 } else {
791                     if (num.contains(ScreenNum)) {
792                         JOptionPane.showMessageDialog(panel1, "屏幕编号已存在,请删除或修改屏幕编号!");
793                     } else {
794                         Model.setValueAt(ScreenNum, ScreenTable.getSelectedRow(), 0);
795                         Model.setValueAt(Contain, ScreenTable.getSelectedRow(), 1);
796                         Model.setValueAt(ContainType, ScreenTable.getSelectedRow(), 2);
797                         Model.setValueAt(ContainColor, ScreenTable.getSelectedRow(), 3);
798                         Model.setValueAt(ScrollType, ScreenTable.getSelectedRow(), 4);
799                         Model.setValueAt(ScrollSpeed, ScreenTable.getSelectedRow(), 5);
800                     }
801                 }
802             }
803         });
804         ScreenInfo.add(btnNewButton_4);
805
806         btnNewButton_5 = new JButton(Res.string().getDelete());
807         btnNewButton_5.setEnabled(false);
808         btnNewButton_5.setBounds(181, 250, 75, 20);
809         btnNewButton_5.addActionListener(new ActionListener() {
810
811             @Override
812             public void actionPerformed(ActionEvent arg0) {
813                 // TODO Auto-generated method stub
814                 // System.out.println(ScreenTable.getSelectedRow());
815                 if (Model.getRowCount() == 0) {
816                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
817                 } else {
818                     Model.removeRow(ScreenTable.getSelectedRow());
819                 }
820             }
821         });
822         ScreenInfo.add(btnNewButton_5);
823
824         textField_21 = new JTextField();
825         textField_21.setEnabled(false);
826         textField_21.setBounds(21, 305, 171, 92);
827         ScreenInfo.add(textField_21);
828         textField_21.setColumns(10);
829
830         JLabel lblNewLabel_4 = new JLabel(Res.string().getScreenNumber() + ":");
831         lblNewLabel_4.setBounds(266, 265, 69, 15);
832         ScreenInfo.add(lblNewLabel_4);
833
834         textField_22 = new JTextField(new String("-1"));
835         textField_22.setEnabled(false);
836         textField_22.setBounds(327, 262, 159, 21);
837         ScreenInfo.add(textField_22);
838         textField_22.setColumns(10);
839
840         JLabel label = new JLabel(Res.string().getContainType() + ":");
841         label.setBounds(266, 297, 69, 15);
842         ScreenInfo.add(label);
843
844         comboBox_4 = new JComboBox();
845         comboBox_4.setEnabled(false);
846         comboBox_4.setModel(new DefaultComboBoxModel(new String[]{Res.string().getOrdinary(),
847                 Res.string().getLocalTime(), Res.string().getQRCode()/* , Res.string().getResource() */}));
848         comboBox_4.setBounds(327, 294, 159, 21);
849         ScreenInfo.add(comboBox_4);
850
851         JLabel label_1 = new JLabel(Res.string().getContainColor() + ":");
852         label_1.setBounds(266, 325, 69, 15);
853         ScreenInfo.add(label_1);
854
855         comboBox_5 = new JComboBox();
856         comboBox_5.setEnabled(false);
857         comboBox_5.setModel(new DefaultComboBoxModel(new String[]{Res.string().getGreen(), Res.string().getRed(),
858                 Res.string().getYellow(), Res.string().getWhite()}));
859         comboBox_5.setBounds(327, 322, 159, 21);
860         ScreenInfo.add(comboBox_5);
861
862         JLabel label_2 = new JLabel(Res.string().getScrollType() + ":");
863         label_2.setBounds(266, 350, 69, 15);
864         ScreenInfo.add(label_2);
865
866         comboBox_6 = new JComboBox();
867         comboBox_6.setEnabled(false);
868         comboBox_6.setModel(new DefaultComboBoxModel(new String[]{Res.string().getNoRolling(),
869                 Res.string().getScrollLeftAndRight(), Res.string().getScrollTopAndDown()}));
870         comboBox_6.setBounds(327, 350, 159, 21);
871         ScreenInfo.add(comboBox_6);
872
873         JLabel label_16 = new JLabel(Res.string().getScrollSpeed() + ":");
874         label_16.setBounds(266, 380, 69, 15);
875         ScreenInfo.add(label_16);
876
877         comboBox_7 = new JComboBox();
878         comboBox_7.setEnabled(false);
879         comboBox_7.setModel(new DefaultComboBoxModel(new String[]{"1", "2", "3", "4", "5"}));
880         comboBox_7.setBounds(327, 377, 159, 21);
881         ScreenInfo.add(comboBox_7);
882
883         JLabel label_18 = new JLabel(Res.string().getContain() + ":");
884         label_18.setBounds(22, 280, 69, 15);
885         ScreenInfo.add(label_18);
886
887         JPanel panel_3 = new JPanel();
888         panel_3.setBounds(520, 5, 240, 405);
889         panel_3.setBorder(
890                 new TitledBorder(null, Res.string().getEventInfo(), TitledBorder.LEFT, TitledBorder.TOP, null, null));
891         panel_1.add(panel_3);
892         panel_3.setLayout(null);
893
894         VideoTableData = new Object[0][3];
895         VideoTable = tableInit(VideoTableData, VideoTableTitle);
896         VideoModel = (DefaultTableModel) VideoTable.getModel();
897         JScrollPane scrollPane_1 = new JScrollPane(VideoTable);
898         scrollPane_1.setBounds(10, 20, 225, 180);
899         panel_3.add(scrollPane_1);
900
901         button_1 = new JButton(Res.string().getAdd());
902         button_1.setEnabled(false);
903         button_1.addActionListener(new ActionListener() {
904
905             @Override
906             public void actionPerformed(ActionEvent arg0) {
907                 // TODO Auto-generated method stub
908                 String containType = null;
909                 String contain = null;
910                 int ScreenNum = Integer.parseInt(textField_22.getText());
911                 contain = textField_23.getText();
912                 if (comboBox_8.getSelectedItem().equals(Res.string().getOrdinary())) {
913                     containType = /* "普通" */Res.string().getOrdinary();
914                 } else if (comboBox_8.getSelectedItem().equals(Res.string().getPlateNumber())) {
915                     containType = /* "车牌号码" */Res.string().getPlateNumber();
916                 } else if (comboBox_8.getSelectedItem().equals(Res.string().getTime())) {
917                     containType = /* "时间" */Res.string().getTime();
918                 } else if (comboBox_8.getSelectedItem().equals(Res.string().getNumericString())) {
919                     containType = /* "数字字符串" */Res.string().getNumericString();
920                 }
921
922                 /*
923                  * VideoModel.setValueAt(ScreenNum, VedioIndex, 0);
924                  * VideoModel.setValueAt(containType, VedioIndex, 1); VedioIndex++;
925                  */
926
927                 List<Integer> num = new ArrayList<Integer>();
928                 for (int i = 0; i < VideoModel.getRowCount(); i++) {
929                     num.add((Integer) VideoModel.getValueAt(i, 0));
930                 }
931                 if (ScreenNum == -1 || contain == null) {
932                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
933                 } else {
934                     if (num.contains(ScreenNum)) {
935                         JOptionPane.showMessageDialog(panel1, "屏幕编号已存在,请删除或修改屏幕编号!");
936                     } else {
937                         VideoModel.addRow(new Object[]{ScreenNum, contain, containType});
938                     }
939                 }
940             }
941         });
942         button_1.setBounds(10, 213, 67, 20);
943         panel_3.add(button_1);
944
945         button_2 = new JButton(Res.string().getModify());
946         button_2.setEnabled(false);
947         button_2.addActionListener(new ActionListener() {
948
949             @Override
950             public void actionPerformed(ActionEvent arg0) {
951                 // TODO Auto-generated method stub
952                 String containType = null;
953                 int ScreenNum = Integer.parseInt(textField_22.getText());
954                 // int ScreenNum = (int)VideoModel.getValueAt(ScreenTable.getSelectedRow(), 0);
955                 String contain = textField_23.getText();
956                 if (comboBox_8.getSelectedItem().equals(Res.string().getOrdinary())) {
957                     containType = /* "普通" */Res.string().getOrdinary();
958                 } else if (comboBox_8.getSelectedItem().equals(Res.string().getPlateNumber())) {
959                     containType = /* "车牌号码" */Res.string().getPlateNumber();
960                 } else if (comboBox_8.getSelectedItem().equals(Res.string().getTime())) {
961                     containType = /* "时间" */Res.string().getTime();
962                 } else if (comboBox_8.getSelectedItem().equals(Res.string().getNumericString())) {
963                     containType = /* "数字字符串" */Res.string().getNumericString();
964                 }
965
966                 List<Integer> num = new ArrayList<Integer>();
967                 for (int i = 0; i < VideoTable.getRowCount(); i++) {
968                     num.add((Integer) VideoTable.getValueAt(i, 0));
969                 }
970                 num.remove(VideoTable.getSelectedRow());
971                 if (VideoTable.getRowCount() == 0) {
972                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
973                 } else {
974
975                     if (num.contains(ScreenNum)) {
976                         JOptionPane.showMessageDialog(panel1,
977                                 "屏幕编号已存在,请删除或修改屏幕编号!");
978                     } else {
979                         VideoModel.setValueAt(ScreenNum,
980                                 VideoTable.getSelectedRow(), 0);
981
982                         VideoModel.setValueAt(contain, VideoTable.getSelectedRow(), 1);
983                         VideoModel.setValueAt(containType, VideoTable.getSelectedRow(), 2);
984                     }
985                 }
986             }
987         });
988         button_2.setBounds(87, 213, 67, 20);
989         panel_3.add(button_2);
990
991         button_4 = new JButton(Res.string().getDelete());
992         button_4.setEnabled(false);
993         button_4.addActionListener(new ActionListener() {
994
995             @Override
996             public void actionPerformed(ActionEvent arg0) {
997                 // TODO Auto-generated method stub
998                 // System.out.println(VideoTable.getSelectedRow());
999                 if (VideoTable.getRowCount() == 0) {
1000                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
1001                 } else {
1002                     VideoModel.removeRow(VideoTable.getSelectedRow());
1003                 }
1004
1005                 /*
1006                  * VideoModel.setValueAt("", VideoTable.getSelectedRow(), 0);
1007                  * VideoModel.setValueAt("", VideoTable.getSelectedRow(), 1); VedioIndex= 0;
1008                  */
1009             }
1010         });
1011         button_4.setBounds(164, 213, 71, 20);
1012         panel_3.add(button_4);
1013
1014         label_17 = new JLabel(Res.string().getContainType() + ":");
1015         label_17.setBounds(10, 252, 69, 15);
1016         panel_3.add(label_17);
1017
1018         comboBox_8 = new JComboBox();
1019         comboBox_8.setEnabled(false);
1020         comboBox_8.setModel(new DefaultComboBoxModel(new String[]{Res.string().getOrdinary(),
1021                 Res.string().getPlateNumber(), Res.string().getTime(), Res.string().getNumericString()}));
1022         comboBox_8.setBounds(71, 249, 159, 21);
1023         panel_3.add(comboBox_8);
1024
1025         label_19 = new JLabel(Res.string().getVoiceText() + ":");
1026         label_19.setBounds(10, 280, 69, 15);
1027         panel_3.add(label_19);
1028
1029         textField_23 = new JTextField();
1030         textField_23.setEnabled(false);
1031         textField_23.setColumns(10);
1032         textField_23.setBounds(10, 305, 220, 92);
1033         panel_3.add(textField_23);
1034
1035         btnNewButton_6 = new JButton(Res.string().getIssued());
1036         btnNewButton_6.setEnabled(false);
1037         btnNewButton_6.addActionListener(new ActionListener() {
1038
1039             @Override
1040             public void actionPerformed(ActionEvent arg0) {
1041                 // TODO Auto-generated method stub
1042                 NET_IN_SET_PARK_CONTROL_INFO pIn = new NET_IN_SET_PARK_CONTROL_INFO();
1043
1044                 pIn.nScreenShowInfoNum = Model.getRowCount();
1045                 // System.out.println(pIn.nScreenShowInfoNum);
1046                 for (int i = 0; i < pIn.nScreenShowInfoNum; i++) {
1047                     pIn.stuScreenShowInfo[i].nScreenNo = Integer.parseInt(String.valueOf(Model.getValueAt(i, 0)));
1048                     try {
1049                         pIn.stuScreenShowInfo[i].szText = String.valueOf(Model.getValueAt(i, 1)).getBytes("GBK");
1050                     } catch (UnsupportedEncodingException e) {
1051                         // TODO Auto-generated catch block
1052                         e.printStackTrace();
1053                     }
1054
1055                     if (String.valueOf(Model.getValueAt(i, 2)).trim().equals(Res.string().getOrdinary())) {
1056                         pIn.stuScreenShowInfo[i].emTextType = 0;
1057                     } else if (String.valueOf(Model.getValueAt(i, 2)).trim().equals(Res.string().getLocalTime())) {
1058                         pIn.stuScreenShowInfo[i].emTextType = 1;
1059                     } else if (String.valueOf(Model.getValueAt(i, 2)).trim().equals(Res.string().getQRCode())) {
1060                         pIn.stuScreenShowInfo[i].emTextType = 2;
1061                     } else if (String.valueOf(Model.getValueAt(i, 2)).trim().equals(Res.string().getResource())) {
1062                         pIn.stuScreenShowInfo[i].emTextType = 3;
1063                     }
1064
1065                     if (String.valueOf(Model.getValueAt(i, 3)).trim().equals(Res.string().getGreen())) {
1066                         pIn.stuScreenShowInfo[i].emTextColor = 0;
1067                     } else if (String.valueOf(Model.getValueAt(i, 3)).trim().equals(Res.string().getRed())) {
1068                         pIn.stuScreenShowInfo[i].emTextColor = 1;
1069                     } else if (String.valueOf(Model.getValueAt(i, 3)).trim().equals(Res.string().getYellow())) {
1070                         pIn.stuScreenShowInfo[i].emTextColor = 2;
1071                     } else if (String.valueOf(Model.getValueAt(i, 3)).trim().equals(Res.string().getWhite())) {
1072                         pIn.stuScreenShowInfo[i].emTextColor = 3;
1073                     }
1074
1075                     if (String.valueOf(Model.getValueAt(i, 4)).trim().equals(Res.string().getNoRolling())) {
1076                         pIn.stuScreenShowInfo[i].emTextRollMode = 0;
1077                     } else if (String.valueOf(Model.getValueAt(i, 4)).trim()
1078                             .equals(Res.string().getScrollLeftAndRight())) {
1079                         pIn.stuScreenShowInfo[i].emTextRollMode = 1;
1080                     } else if (String.valueOf(Model.getValueAt(i, 4)).trim()
1081                             .equals(Res.string().getScrollTopAndDown())) {
1082                         pIn.stuScreenShowInfo[i].emTextRollMode = 2;
1083                     }
1084                     System.out.println(String.valueOf(Model.getValueAt(i, 5)).trim());
1085                     System.out.println(Res.string().getSpeed() + "1");
1086                     if (String.valueOf(Model.getValueAt(i, 5)).trim().equals(Res.string().getSpeed() + "1")) {
1087                         pIn.stuScreenShowInfo[i].nRollSpeed = 1;
1088                     } else if (String.valueOf(Model.getValueAt(i, 5)).trim().equals(Res.string().getSpeed() + "2")) {
1089                         pIn.stuScreenShowInfo[i].nRollSpeed = 2;
1090                     } else if (String.valueOf(Model.getValueAt(i, 5)).trim().equals(Res.string().getSpeed() + "3")) {
1091                         pIn.stuScreenShowInfo[i].nRollSpeed = 3;
1092                     } else if (String.valueOf(Model.getValueAt(i, 5)).trim().equals(Res.string().getSpeed() + "4")) {
1093                         pIn.stuScreenShowInfo[i].nRollSpeed = 4;
1094                     } else if (String.valueOf(Model.getValueAt(i, 5)).trim().equals(Res.string().getSpeed() + "5")) {
1095                         pIn.stuScreenShowInfo[i].nRollSpeed = 5;
1096                     }
1097                     // pIn.stuScreenShowInfo[i].nRollSpeed =
1098                     // Integer.parseInt(String.valueOf(Model.getValueAt(i, 5))) ;
1099                 }
1100                 pIn.nBroadcastInfoNum = VideoModel.getRowCount();
1101                 System.out.println(pIn.nBroadcastInfoNum);
1102                 for (int i = 0; i < pIn.nBroadcastInfoNum; i++) {
1103                     System.out.println(String.valueOf(VideoModel.getValueAt(i, 2)).trim());
1104                     try {
1105                         System.out.println(new String(pIn.stuBroadcastInfo[i].szText, "GBK").trim());
1106                         pIn.stuBroadcastInfo[i].szText = String.valueOf(VideoModel.getValueAt(i, 1)).getBytes("GBK");
1107                     } catch (UnsupportedEncodingException e) {
1108                         // TODO Auto-generated catch block
1109                         e.printStackTrace();
1110                     }
1111                     if (String.valueOf(VideoModel.getValueAt(i, 2)).trim().equals(Res.string().getOrdinary())) {
1112                         pIn.stuBroadcastInfo[i].emTextType = 0;
1113                     } else if (String.valueOf(VideoModel.getValueAt(i, 2)).trim()
1114                             .equals(Res.string().getPlateNumber())) {
1115                         pIn.stuBroadcastInfo[i].emTextType = 1;
1116                     } else if (String.valueOf(VideoModel.getValueAt(i, 2)).trim().equals(Res.string().getTime())) {
1117                         pIn.stuBroadcastInfo[i].emTextType = 2;
1118                     } else if (String.valueOf(VideoModel.getValueAt(i, 2)).trim()
1119                             .equals(Res.string().getNumericString())) {
1120                         pIn.stuBroadcastInfo[i].emTextType = 3;
1121                     }
1122                 }
1123                 if (pIn.nScreenShowInfoNum == 0 && pIn.nBroadcastInfoNum == 0) {
1124                     JOptionPane.showMessageDialog(panel1, Res.string().getPrompt());
1125                 } else {
1126                     if (controlDevice(pIn)) {
1127                         JOptionPane.showMessageDialog(panel1, Res.string().getSetUpSuccess());
1128                     } else {
1129                         JOptionPane.showMessageDialog(panel1, Res.string().getSetUpFailed());
1130                     }
1131                 }
1132             }
1133         });
1134         btnNewButton_6.setBounds(652, 413, 93, 23);
1135         panel_1.add(btnNewButton_6);
1136
1137     }
1138
1139     public JTable tableInit(Object[][] data, String[] columnName) {
1140         JTable table;
1141         DefaultTableModel model;
1142         model = new DefaultTableModel(data, columnName);
1143         table = new JTable(model) {
1144             @Override // 不可编辑
1145             public boolean isCellEditable(int row, int column) {
1146                 return false;
1147             }
1148         };
1149         model = (DefaultTableModel) table.getModel();
1150
1151         table.setPreferredScrollableViewportSize(new Dimension(500, 500));
1152         table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 只能选中一行
1153
1154         // 列表显示居中
1155         DefaultTableCellRenderer dCellRenderer = new DefaultTableCellRenderer();
1156         dCellRenderer.setHorizontalAlignment(JLabel.CENTER);
1157         table.setDefaultRenderer(Object.class, dCellRenderer);
1158         return table;
1159     }
1160
1161     public Boolean controlDevice(NET_IN_SET_PARK_CONTROL_INFO pIn) {
1162         for (int i = 0; i < 5; i++) {
1163             System.out.println(pIn.stuScreenShowInfo[i].emTextType);
1164         }
1165
1166         int emType = CtrlType.CTRL_SET_PARK_CONTROL_INFO;
1167         // System.out.println(new String(pIn.stuScreenShowInfo[0].szText));
1168         NET_OUT_SET_PARK_CONTROL_INFO pOut = new NET_OUT_SET_PARK_CONTROL_INFO();
1169         pIn.write();
1170         pOut.write();
1171         Boolean ret = LoginModule.netsdk.CLIENT_ControlDeviceEx(LoginModule.m_hLoginHandle, emType, pIn.getPointer(),
1172                 pOut.getPointer(), 3000);
1173         if (ret) {
1174             System.out.println("CLIENT_ControlDeviceEx success");
1175         } else {
1176             System.out.println("CLIENT_ControlDeviceEx fail " + getErrorCode());
1177         }
1178         return ret;
1179
1180     }
1181
1182     public String getErrorCode() {
1183         return " { error code: ( 0x80000000|" + (LoginModule.netsdk.CLIENT_GetLastError() & 0x7fffffff)
1184                 + " ). 参考  NetSDKLib.java }";
1185     }
1186 }