欢迎来到天天文库
浏览记录
ID:35198663
大小:25.50 KB
页数:9页
时间:2019-03-21
《arq协议模拟实现java》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Timer.java文件packagecommon;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.text.SimpleDateFormat;importjava.util.Date;importjavax.swing.Timer;importjavax.swing.JTextField;publicclassTime{Datenow;Timertimer;JTextFieldlbl;publicTime(JTextFieldl){lbl=l;timer=newTimer
2、(1000,newActionListener(){publicvoidactionPerformed(ActionEvente){now=newDate(now.getTime()-1000);SimpleDateFormatformatter=newSimpleDateFormat("HH:mm:ss");lbl.setText(formatter.format(now));}});}@SuppressWarnings("deprecation")publicvoidtime_start(){//lbl.setText("00:00:10");now=newDate();now.
3、setHours(0);now.setMinutes(0);now.setSeconds(10);timer.start();}publicvoidtime_stop(){timer.stop();lbl.setText("00:00:10");}publicvoidtime_restart();timer.stop();this.time_start();}}ARQ.java文件importjava.awt.*;importjava.awt.event.*;importjavax.swing.BoxLayout;importjavax.swing.JFrame;importjava
4、x.swing.JLabel;importjavax.swing.JButton;importjavax.swing.JScrollPane;importjavax.swing.JTextField;importjavax.swing.JPanel;importjavax.swing.JRadioButton;importjavax.swing.ButtonGroup;importjavax.swing.JTable;importjavax.swing.event.DocumentEvent;importjavax.swing.event.DocumentListener;impor
5、tjavax.swing.table.*;importjavax.swing.text.Document;importjava.io.FileWriter;importjava.io.IOException;importcommon.Time;publicclassARQextendsJFrame{privatestaticfinallongserialVersionUID=-5437589209629747957L;privateintNUM;privateTimeT;privateJTextField[]status;privateJButtonb;privateJRadioBu
6、tton[]r;DefaultTableModelm_data;JTablem_view;FileWriterf1;FileWriterf2;FileWriterf3;publicARQ()throwsIOException{super("ARQ");NUM=0;Containerc=getContentPane();c.setLayout(newFlowLayout());JPanel[]P=newJPanel[2];P[0]=newJPanel();P[0].setLayout(newBoxLayout(P[0],BoxLayout.X_AXIS));c.add(P[0]);P[
7、1]=newJPanel();c.add(P[1]);JPanel[]Q=newJPanel[2];Q[0]=newJPanel();Q[0].setLayout(newBoxLayout(Q[0],BoxLayout.Y_AXIS));P[0].add(Q[0]);Q[1]=newJPanel();Q[1].setLayout(newBoxLayout(Q[1],BoxLayout.Y_AXIS));P[0].add(Q[1]);JPanel[]R=ne
此文档下载收益归作者所有