import java.awt.event.*;
import javax.swing.*;
import java.util.*;
//=============================================
//Main Class
//=============================================
public class GreedSnake implements KeyListener
{
JFrame mainFrame;
Canvas paintCanvas;
JLabel labelScore;//计分牌
SnakeModel snakeModel=null;// 蛇
public static final int canvasWidth=200;
public static final int canvasHeight=300;
public static final int nodeWidth=10;
public static final int nodeHeight=10;
//----------------------------------------------------------------------
//GreedSnake():初始化游戏界面
//----------------------------------------------------------------------
public GreedSnake()
{
文章来源于领测软件测试网 https://www.ltesting.net/