public void actionPerformed(ActionEvent e) {
int a = s;// =(int)(Math.random()*20);
int b = Integer.valueOf(jt1.getText());
long start =0;
if (e.getSource() == jb3) {
start= System.currentTimeMillis();//将他设置成全局的变量
}
if (e.getSource() == jb1) {
if (b > a) {
jt2.setText("你猜大了!");
}
if (b < a) {
jt2.setText("你猜小了!");
}
if (b == a) {
jt2.setText("你猜对了");
long x = System.currentTimeMillis(); // jt3.setText((System.currentTimeMillis()
// - start) + "ms");
jt3.setText((x - start) + "ms");
}
}
}
改成start