📄 applet1.java~22~
字号:
package thread;import java.awt.*;import java.awt.event.*;import java.applet.*;import java.util.*;import javax.swing.*;import java.lang.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class Applet1 extends Applet { boolean isStandalone = false; //Get a parameter value public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } private Thread clockthread=null; //Construct the applet public Applet1() { } //Initialize the applet public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { } //Get Applet information public String getAppletInfo() { return "名称:时钟线程\r\n"+"作者:陆正武\r\n"; } //Get parameter info public String[][] getParameterInfo() { return null; } public void dedtroy() {} public void paint(Graphics currenttime) { Date current =new Date(); Color mycolor=new Color(255); currenttime.setColor(mycolor); Font myfont=new Font("TimesRoman",Font.BOLD,20); currenttime.setFont(myfont); currenttime.drawString("当前系统时间为:"+current.getHours()+":"+current.getMinutes()+":"+current.getSeconds(),30,60); } public void start() { if(clockthread==null) { clockthread=new Thread("clockthread"); clockthread.start(); } } public void stop() { clockthread=null; } public void run() { while(Thread.currentThread()==clockthread) { repaint(); try {Thread.sleep(1000); } catch(Exception e) {} } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -