一個經典的JAVA APPLET程式(二)

來源:互聯網
上載者:User
接著上面的部分,下面是APPLET主程式部分:
public class MyClock extends Applet implements Runnable
{
    static final int BACKGROUND=0;              //背景圖片的序號,供數組使用
    static final int LOGO=1;                    //LOGO圖片的序號,供數組使用
    static final String JAVEX="bear";          //錶盤上顯示的文字
    static final double MINSEC=0.104719755;     //分針和秒針在錶盤上的刻度(60個)間的弧度
    static final double HOUR=0.523598776;       //時針在錶盤上的刻度(24個)間的弧度
    Thread clockThread = null; //使用多線程機制,用另一個線程不斷顯示圖片
    //提供的預設參數,如果HTML檔案裡面沒有給參數就使用
    int width = 100;
    int height = 100;
    Color bgColor = new Color(0,0,0);
    Color faceColor = new Color(0,0,0);
    Color sweepColor = new Color(255,0,0);
    Color minuteColor = new Color (192,192,192);
    Color hourColor = new Color (255,255,255);
    Color textColor = new Color (255,255,255);
    Color caseColor = new Color (0,0,0);
    Color trimColor = new Color (192,192,192);
    String logoString=null;
    Image images[] = new Image[2]; //背景和LOGO的圖片
    boolean isPainted=false; //如果第一次載入時繪製背景及錶盤,其他時候重繪則只繪製指標
    //時鐘圓心的位置
    int x1,y1;
    //最上面那個三角形的刻度圖形的座標
    int xPoints[]=new int[3], yPoints[]=new int[3];

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.