import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
public class Th extends Thread implements Runnable{
Th() throws InterruptedException{
JLabel time = new JLabel("99");
Font a=new Font("Tohama",Font.PLAIN,35);
JFrame frame =new JFrame();
frame.setLayout(null);
frame.setSize(500,500);
frame.setVisible(true);
frame.add(time);
time.setBounds(10, 0, 100, 50);
time.setFont(a);
for(int i = 99;i >0;i--)
{
sleep(1000);
time.setText(""+i);
if(i == 95){
JOptionPane.showMessageDialog(null, "out of time");
System.exit(0);
}
}
}
public static void main(String[] args) throws InterruptedException {
new Th();
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น