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;
|
}
|
|
|
|
}
|