import java.awt.Graphics;import javax.swing.*;import java.util.Calendar;public class Clock extends JApplet implements Runnable{ Thread clockThread; public void start(){ if(clockThread==null){ clockThread=new Thread(this,"Clock"); clockThread.start(); } } public void run(){ while(clockThread!=null){ repaint(); try{ clockThread.sleep(1000); }catch(InterruptedException e){ } } } public void paint( Graphics g) { Calendar calendar = Calendar.getInstance(); long a=calendar.getTimeInMillis(); calendar.setTimeInMillis(a); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); int hour = calendar.get(Calendar.HOUR_OF_DAY); int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); String time=""; time=year+"年"+month+"月"+day+"日"+" "+hour+":"+minute+":"+second; super.paint(g); g.drawString(time,25,25); } public void stop(){ clockThread.stop(); clockThread=null; }}<html><applet code = "Clock.class" width = "400" height = "300" /></html> </html>