content: package com.neusoft.planewar.core;
  
  import java.awt.Color;
  import java.awt.Frame;
  import java.awt.Graphics;
  import java.awt.Image;
  import java.awt.Point;
  import java.awt.event.WindowAdapter;
  import java.awt.event.WindowEvent;
  
  import com.neusoft.planewar.constant.Constant;
  import com.neusoft.planewar.util.ImageUtil;
  
  /**
   * ϷԶ崰ڵĸ һΣʹ
   * 
   * @author zzk
   *
   */
  public class MyFrame extends Frame {
  	/**
  	 * Զɴڵķ
  	 * 
  	 * @throws InterruptedException
  	 */
  	public void launchFrame() {
  		// ôڴС
  		setSize(Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
  		// ôλ
  		// setLocation(0, 0);
  		setLocationRelativeTo(null);// ԾУnullʾĻ
  		// ôڱ
  		setTitle("ɻս");
  		// ÿɼ
  		setVisible(true);
  		// òܸıС
  		setResizable(false);
  		// ùرմ
  		addWindowListener(new WindowAdapter() {
  			@Override
  			public void windowClosing(WindowEvent e) {
  				System.exit(0);// ùر
  			}
  		});
  		enableInputMethods(false);//뷨
  		setBackground(Color.BLACK);
  
  		new MyThread().start();
  
  	}
  
  	/**
  	 * ֹͼƬ˸
  	 * 
  	 * @param g
  	 */
  	Image backImg = null;
  
  	@Override
  	public void update(Graphics g) {
  		if (backImg == null) {
  			backImg = createImage(Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
  		}
  		Graphics backg = backImg.getGraphics();
  		Color c = backg.getColor();
  		backg.setColor(Color.BLACK);
  		backg.fillRect(0, 0, Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
  		backg.setColor(c);
  		paint(backg);		
  		g.drawImage(backImg, 0, 0, null);
  	}
  
  	/**
  	 *  һ»߳ڲ
  	 * 
  	 * @param args
  	 */
  	class MyThread extends Thread {
  		@Override
  		public void run() {
  			while (true) {
  				repaint();
  				try {
  					Thread.sleep(30);
  				} catch (InterruptedException e) {
  					e.printStackTrace();
  				}
  			}
  		}
  	}
  }
  