package cn.bjsxt.util;

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;


public class MyFrame  extends Frame {
	
	/**
	 * ش
	 */
	public void launchFrame(){
		setSize(Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
		setLocation(100, 100);
		setVisible(true);
		
		new PaintThread().start();  //ػ߳
		
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
	}
	
	
	private Image offScreenImage = null;
	public void update(Graphics g) {
		if(offScreenImage == null)
			offScreenImage = this.createImage(Constant.GAME_WIDTH,Constant.GAME_HEIGHT);
		
		Graphics gOff = offScreenImage.getGraphics();

		paint(gOff);
		g.drawImage(offScreenImage, 0, 0, null);
	}
	
	/**
	 * һػڵ߳࣬һڲ
	 * @author dell
	 *
	 */
	class PaintThread extends Thread {
		
		public void run(){
			while(true){
				repaint();
				try {
					Thread.sleep(40); //1s = 1000ms
				} catch (InterruptedException e) {
					e.printStackTrace();
				}   
			}
		}
		
	}
}

@@ -219,24 +219,8 @@
 %09%0D%0A%09
-/**%0D%0A%09 * %D8%B4%0D%0A%09 */
 %0D%0A%09p
@@ -386,12 +386,8 @@
 );  
-//%D8%BB%DF%B3
 %0D%0A%09%09
@@ -848,53 +848,8 @@
 %09%0D%0A%09
-/**%0D%0A%09 * %D2%BB%D8%BB%DA%B5%DF%B3%E0%A3%AC%D2%BB%DA%B2%0D%0A%09 * @author dell%0D%0A%09 *%0D%0A%09 */
 %0D%0A%09c

Update MyFrame.java