⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clock.java

📁 很好得jbuilder100例源代码
💻 JAVA
字号:
import java.awt.*;import java.awt.event.*;import java.applet.*;import  java.util.Date;public class clock extends java.applet.Applet implements Runnable{   Font myfont=new Font("TimesRoman",Font.BOLD,18);   Color mycolor=new Color(255,0,0);   Date mydate;   Thread runner;  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);  }  public void start(){   if(runner==null){      runner=new Thread(this);      runner.start();      }  }  public void stop(){   if(runner!=null){       runner.stop();       runner=null;   }  }   public void run(){      while(true){        mydate=new Date();        repaint();        try{           Thread.sleep(1000); }        catch(InterruptedException e){}      }   }   public void paint(Graphics g)   {g.setFont(myfont);   g.setColor(mycolor);   g.drawString(mydate.toString(),20,100);   }  /**Construct the applet*/  public clock() {  }  /**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 "Applet Information";  }  /**Get parameter info*/  public String[][] getParameterInfo() {    return null;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -