zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
package Frame;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.filechooser.FileNameExtensionFilter;
 
import BaoWen.Dell_55AA01;
import ColorAndFont.ChooseFont;
import ColorAndFont.English;
import ColorAndFont.UIColor;
import Method.AddTxt;
import PbuliClass.JButtonModel;
import PbuliClass.JlableModel;
import PbuliClass.ShowMessage;
import PbuliClass.Systems;
import PbuliClass.jinternalFrame;
 
/**GPSÊý¾Ý»Ø·Å¹¦ÄÜ*/
public class Gps_data_hui_fang extends jinternalFrame{
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
 
    //¼ÓÔØµÄÊýÁ¿
    static JButtonModel jbt_num=null;
 
    //¼ÓÔØ°´Å¥
    JButtonModel jbt_jiazai=null;
    
    //Ñ¡ÔñÎļþ
    JButtonModel Jbt_wenjian=null;
 
    //¿ªÊ¼/ÔÝÍ£°´Å¥
    JButtonModel jbt_kaishi=null;
 
    //Çå¿Õ°´Å¥
    JButtonModel jbt_clear=null;
    
    //ת¶È¸ñʽÊä³ö
    JButtonModel jbt_2d=null;
 
    //È·¶¨°´Å¥
    JButtonModel jbt_sure=null;
 
    JTextArea textArea=null;
 
    JTextField  jt_time=null;//»Ø·ÅËÙ¶È
 
    //»Ø·ÅËÙ¶È
    JlableModel jl_hf=null;
    
    //ÎļþµØÖ·
    JTextField Jt_wenjian=null;
    
    
 
    JPanel mb=null;
    JScrollPane scrollPane=null;
    
    static boolean startok=false;
    static boolean d2dd=false;//¶È·Öת¶È
    
    int jiazainum=0;
    int numover=0;
    
    String path;
 
    public Gps_data_hui_fang() {
        String title="Êý¾Ý»Ø·Å";
        if(Systems.sys().getLanguage().equals("English")) {
            title="Data playback";
        }
        this.setTitle(title);
        Container rq=getContentPane();//»ñÈ¡ÈÝÆ÷
        rq.setLayout(new BorderLayout());
        rq.setBackground(UIColor.getNorth_color());
        rq.add(getMb(),BorderLayout.NORTH);
        rq.add(getScrollPane(),BorderLayout.CENTER);    
        this.setFrameIcon(new ImageIcon("image/icon/TCP.png"));//ÉèÖô°Ìåͼ±ê    
        this.addInternalFrameListener(new InternalFrameListener() {
            public void internalFrameOpened(InternalFrameEvent e) {                
            }
            
            public void internalFrameIconified(InternalFrameEvent e) {
                
            }
            
            public void internalFrameDeiconified(InternalFrameEvent e) {
                
            }
            
            public void internalFrameDeactivated(InternalFrameEvent e) {                
            }
            
            public void internalFrameClosing(InternalFrameEvent e) {
            }
            
            public void internalFrameClosed(InternalFrameEvent e) {    
                textArea.setText("");
                textArea=null;
                AddTxt.getBaowen().removeAllElements();
            }
            
            public void internalFrameActivated(InternalFrameEvent e) {
                
            }
        });
    }
 
 
 
    public static JButtonModel getJbt_num() {
        if(jbt_num==null) {
            jbt_num=new JButtonModel(English.name("ÒѼÓÔØÊý", "Loaded"));
        }
        return jbt_num;
    }
 
    public JButtonModel getJbt_jiazai() {
        if(jbt_jiazai==null) {
            jbt_jiazai=new JButtonModel(English.name("¼ÓÔØ", "Loaded"));
            jbt_jiazai.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    AddTxt.getBaowen().removeAllElements();
                    if(path.length()<5) {
                        ShowMessage.zidingyi("ÇëÏßÑ¡ÔñÐèÒª¼ÓÔØµÄÎļþ...");
                        return;
                    }
                    AddTxt.readtxt(path);
                    numover=AddTxt.getBaowen().size();
                    jbt_kaishi.setText("¿ªÊ¼»Ø·Å");
                    startok=false;
                    textArea.setText("");    
                    jiazainum=0;
                }
            });
        }
        return jbt_jiazai;
    }
 
    public JButtonModel getJbt_kaishi() {
        if(jbt_kaishi==null) {
            jbt_kaishi=new JButtonModel(English.name("¿ªÊ¼»Ø·Å", "Start"));
            jbt_kaishi.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if(startok) {
                        jbt_kaishi.setText("¿ªÊ¼»Ø·Å");
                        startok=false;
                    }else {
                        jbt_kaishi.setText("ÔÝÍ£»Ø·Å");
                        startok=true;
                        ding_shi_qi();
                    }
                    
                }
            });
        }
        return jbt_kaishi;
    }
 
    public JButtonModel getJbt_clear() {
        if(jbt_clear==null) {
            jbt_clear=new JButtonModel(English.name("Çå¿Õ", "Clear"));
            jbt_clear.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    textArea.setText("");
                }
            });
        }
        return jbt_clear;
    }
 
    public JButtonModel getJbt_sure() {
        if(jbt_sure==null) {
            jbt_sure=new JButtonModel(English.name("È·¶¨", "Submit"));
        }
        return jbt_sure;
    }
 
    public JTextArea getTextArea() {
        if(textArea==null) {
            textArea=new JTextArea();
            textArea.setFont(ChooseFont.getFont(14));
            textArea.setBackground(UIColor.getNorth_color());
        }
        return textArea;
    }
 
    public JTextField getJt_time() {
        if(jt_time==null) {
            jt_time=new JTextField(3);
            jt_time.setText("1000");
        }
        return jt_time;
    }
 
    public JlableModel getJl_hf() {
        if(jl_hf==null) {
            jl_hf=new JlableModel(English.name("»Ø·ÅËÙ¶È(ms)", "Speed"));
        }
        return jl_hf;
    }
 
    public JPanel getMb() {
        if(mb==null) {
            mb=new JPanel();
            mb.setBackground(UIColor.getNorth_color());
            Box topicBox = Box.createHorizontalBox();
            topicBox.add(getJt_wenjian());
            topicBox.add(Box.createHorizontalStrut(3));
            topicBox.add(getJbt_wenjian());
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJbt_num() );
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJbt_jiazai());
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJbt_kaishi());
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJbt_clear());
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJbt_2d() );
            topicBox.add(Box.createHorizontalStrut(10));
            topicBox.add(getJl_hf());
            topicBox.add(Box.createHorizontalStrut(2));
            topicBox.add(getJt_time());
//            topicBox.add(Box.createHorizontalStrut(5));
//            topicBox.add(getJbt_sure() );
            mb.add(topicBox);
        }
        return mb;
    }
 
    public JScrollPane getScrollPane() {
        if(scrollPane==null) {
            scrollPane=new JScrollPane( getTextArea());
            
        }
        return scrollPane;
    }
    
    public void setJbt_clear(JButtonModel jbt_clear) {
        this.jbt_clear = jbt_clear;
    }
 
 
 
    /**¶¨Ê±Æ÷*/
    public  void ding_shi_qi() {        
        Integer cacheTime =Integer.parseInt(getJt_time().getText().trim());
        Timer timer = new Timer(); 
        timer.schedule(new TimerTask() { 
            @Override  
            public void run() {  
                try {         
                    
                    if(1<=numover && startok) {
                        Dell_55AA01.dell_gui();
                        String message=AddTxt.getBaowen().get(jiazainum);
                        numover--;
                        getJbt_num().setText(" Ê£Óà"+numover+"Ìõ ");
                        textArea.append("    "+message+"\n");
                        textArea.setCaretPosition(textArea.getText().length());
                        AddTxt.dos(message,8233);
                        jiazainum++;
                    }else {                        
                        timer.cancel();
                    }
                    
 
                } catch (Exception e) {
                    // TODO ×Ô¶¯Éú³ÉµÄ catch ¿é
                    e.printStackTrace();
                }  
            }  
        }, 1000, cacheTime);  
 
    }
 
 
 
    public JButtonModel getJbt_wenjian() {
        if(Jbt_wenjian==null) {
            Jbt_wenjian=new JButtonModel("Ñ¡ÔñÎļþ");
            Jbt_wenjian.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {                    
                    JFileChooser fileChooser=new JFileChooser("./savefile/");//ÎļþÑ¡ÔñÆ÷                    
                    FileNameExtensionFilter filter=new FileNameExtensionFilter("txtÎļþ", "txt");//Îļþ¹ýÂËÆ÷
                    fileChooser.setFileFilter(filter);//Ìí¼ÓÎļþ¹ýÂËÆ÷
                    int i=fileChooser.showOpenDialog(getMb());//ÏÔʾѡÔñÎļþ¶Ô»°¿ò
                    if(i==JFileChooser.APPROVE_OPTION) {//Èç¹ûÓû§Ñ¡ÔñµÄÊÇ¡°´ò¿ª¡±°´Å¥
                        File file=fileChooser.getSelectedFile();//»ñȡѡÖеÄÎļþ                
                        String fileName=file.getName();//ÎļþÃû³Æ
                        //ÎļþÃû³Æ
                        path = "savefile/"+fileName;//·¾¶
                        Jt_wenjian.setText(fileName);
 
                    }
                    else {
                        return;
                    }
                }
            });
        }
        return Jbt_wenjian;
    }
 
 
 
    public JTextField getJt_wenjian() {
        if(Jt_wenjian==null) {
            Jt_wenjian=new JTextField(15);
        }
        return Jt_wenjian;
    }
 
 
 
    public JButtonModel getJbt_2d() {
        if(jbt_2d==null) {
            jbt_2d=new JButtonModel(English.name("¶È·Öת¶È", "todu"));
            jbt_2d.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if(d2dd) {
                        d2dd=false;
                        jbt_2d.setBackground(Color.blue);
                    }else {
                        d2dd=true;
                        jbt_2d.setBackground(Color.red);
                    }
                }
            });
        }
        return jbt_2d;
    }
 
 
 
 
    public static boolean isD2dd() {
        return d2dd;
    }
 
 
 
    public static void setD2dd(boolean d2dd) {
        Gps_data_hui_fang.d2dd = d2dd;
    }
 
 
 
    public static boolean isStartok() {
        return startok;
    }
 
 
 
    public static void setStartok(boolean startok) {
        Gps_data_hui_fang.startok = startok;
    }
 
 
 
}