package com.aa;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Agent extends JFrame{
public static int sec=7;
static JFrame frame =null;
final static JLabel label = new JLabel();
public void F(JFrame frame,JLabel label,int sec){
String s="00:00:0";
s+=String.valueOf(sec);
System.out.println("s="+s);
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
label.setText(s);
}
public static void main(String[] args){
final Agent a=new Agent();
frame = new JFrame("d");
Container c =frame.getContentPane();
c.setLayout(null);
frame.setUndecorated(true);
Dimension dimen = Toolkit.getDefaultToolkit().getScreenSize();
int width = (int)(dimen.getWidth());
int height = (int)(dimen.getHeight());
System.out.println("width="+width);
System.out.println("height="+height);
int w=250;
int h=100;
int ww=width-w;
int hh=height-h;
frame.setSize(w,h);
frame.setLocation(ww, hh);
label.setForeground(Color.red);
label.setSize(250, 50);
label.setLocation(20, 7);
label.setFont(new Font("궁서",50,50));
//label.setFont(new Font("궁서",10,10));
//label.setSize(30,10);
//label.setLocation(0,0);
c.add(label);
///frame.setLocation(500, 400);
frame.setPreferredSize(new Dimension(400,340));
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final Timer m_timer = new Timer();
TimerTask m_task = new TimerTask(){
@Override
public void run() {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("test");
sec--;
a.F(frame,label,sec);
System.out.println("sec="+sec);
if(sec==0){
LoginFrame lf = new LoginFrame();
System.out.println("sec==0");
m_timer.cancel();
System.out.println("end");
}
}
};
m_timer.schedule(m_task, 0, 1000);
}
}