精选优质文档-倾情为你奉上Java贪吃蛇源代码 import java.awt.*; import java.awt.event.*; public class GreedSnake /主类 /* * param args */ public static void main(String args) / TODO Auto-generated method stub new MyWindow(); class MyPanel extends Panel implements KeyListener,Runnable/自定义面板类,继承了键盘和线程接口 Button snake; /定义蛇按钮 int shu=0; /蛇的节数 int food; /食物数组 boolean result=true; /判定结果是输 还是赢 Thread thread; /定义线程 static int weix,weiy; /食物位置 boolean t=true; /判定游戏是