生成主类对象--面板CPane.setOpaque(true);//面板要求不透明frame.setContentPane(CPane);//设置主类对象为主窗体的内容面板frame.pack();//主窗体紧缩显示frame.setVisible(true);//设置主窗体可见}publicstaticvoidmain(String[]args){//将createGUI()列入线程javax.swing.SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){createGUI();}});}}11.利用线程方法编写JApplet程序,实现在浏览器端实时动态显示本地系统时钟//ProgrammeNameWatch.javaimportjava.applet.Applet;importjava.awt.*;importjava.text.DateFormat;importjava.util.*;lassWatchextendsApplet{publicvoidpaint(Graphicsg){Dated=newDate();DateFormatldf=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG);//System.out.println("现在系统时间是(long):"+ldf.format(d));Stringtime=ldf.format(d).toString();g.drawString(time,100,100);try{Thread.sleep(1000);}catch(InterruptedExceptione){}repaint();}}<html><head><title>JavaAppletDemo</title>