package ss; import java.awt.Graphics; import java.awt.Image; import java.awt.Point; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JOptionPane; /** * 1.继承窗体类为当前类的父类 * @author lizhicheng * */ public class PushBox extends JFrame implements KeyListener{ /** * 3.声明一个二维数组的地图 */ int[][] maps= { {3,3,3,3,3,3,3,3}, {3,0,0,0,0,0,0,3}, {3,0,0,0,0,2,0,3},//3表示墙 {3,0,0,0,3,0,3,3},//2表示箱子 {3,0,0,1,0,0,0,3},//1表示人 {3,0,3,0,2,0,0,3},//0表示空地