这是一个线程启动的时钟框。
public class ThreadClock extends JFrame implements Runnable{
private volatile BufferedImage boardDrawing;//volatile是程度较轻的 synchronizedprivate volatile BufferedImage boardDisplaying;
public ThreadClock()
{
setTitle("当前时间");//标题名称
setSize(300, 300);//展示框的大小
setLocation(0,100);//初始展现的位置
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setVisible(true);
boardDrawing = new BufferedImage(this.getWidth(), this.getHeight(), BufferedImage.TYPE_INT_RGB);
boardDisplaying = new BufferedImage(this.getWidth(), this.getHeight(), BufferedImage.TYPE_INT_RGB);
}