CHING 可否將此 Applet 轉為 Application

  1. import java.applet.Applet;
  2. import java.awt.*;
  3. import java.util.Random;

  4. public class A extends Applet
  5.        implements Runnable
  6. {
  7.        public void init()
  8.        {
  9.        }
  10.       
  11.       public boolean handleEvent(Event event)
  12.       {
  13.            ///
  14.            return false;
  15.       }
  16.       public void start()
  17.       {
  18.             thread = new Thread(this);
  19.             thread.start();
  20.       }

  21.      public void stop()
  22.      {
  23.           thread.stop();
  24.      }
  25.    
  26.     public void run()
  27.     {
  28.         do
  29.         {
  30.             repaint();
  31.             try
  32.             {
  33.                 Thread.sleep(33L);
  34.             }
  35.             catch(InterruptedException _ex) { }
  36.         } while(true);
  37.     }

  38.    public void update(Graphics g)
  39.    {
  40.        paint(g);
  41.    }

  42.    public void paint(Graphics g)
  43.    {
  44.          ///////////
  45.    }

  46.    private Thread thread;
  47. }
  48.       
複製代碼
如果轉做 Application, 個 Program
個FLOW大概是怎樣?
THX

Hi
  1. public void update(Graphics g)
  2.    {
  3.        paint(g);
  4.    }
複製代碼
這個method 是屬於APPLET,想請問如果這是 Application
我應該幾時UPDATE 個 Canvas?
THX

TOP