大哥帮帮菜鸟吧.因为我真的很菜哦.
import java.awt.*;import java.applet.*;
import java.util.Date;
import sun.applet.AppletEvent;
import sun.misc.Timeable;
import sun.misc.Timer;
public class Clock extends AppletEvent implements Timeable {
Thread clockThread;
Font font;
public void init(){
font=new Font("TimesRoman",Font.BOLD,63);
}
public void init(){
font=new Font("TimesToman",Font.BOLD,64);
}
public void start(){
if(clockThread==null){
clockThread=new Thead(this,"Show time");
clockThread.start();
}
public void run(){
while(clockThread!=null){
repaint();
try{
clodkThread.sleep(1000);
}catch(InterruptdeException e)
{
}
}
}
public void paint(Graphics g){
date now=new Date();
g.setFont(font);
g.setColor(Color.red);
g.drawString(now.getHours()+":"+now.getMinutes()+":"+
now.getseconds(),5,50);
}
}
public void stop(){
clockThread.stop();
}
}