1 / 4
文档名称:

java小游戏连连看源代码.doc

格式:doc   页数:4
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

java小游戏连连看源代码.doc

上传人:所以所以 2012/6/10 文件大小:0 KB

下载得到文件列表

java小游戏连连看源代码.doc

文档介绍

文档介绍:Java小游戏——连连看源码
连连看java源代码
import .*;
import .*;
import .*;
public class lianliankan implements ActionListener
{
JFrame mainFrame; //主面板
Container thisContainer;
JPanel centerPanel,southPanel,northPanel; //子面板
JButton diamondsButton[][] = new JButton[6][5];//游戏按钮数组
JButton exitButton,resetButton,newlyButton; //退出,重列,重新开始按钮
JLabel fractionLable=new JLabel("0"); //分数标签
JButton firstButton,secondButton; //分别记录两次被选中的按钮
int grid[][] = new int[8][7];//储存游戏按钮位置
static boolean pressInformation=false; //判断是否有按钮被选中
int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标
int i,j,k,n;//消除方法控制
public void init(){
mainFrame=new JFrame("JKJ连连看");
thisContainer = ();
(new BorderLayout());
centerPanel=new JPanel();
southPanel=new JPanel();
northPanel=new JPanel();
(centerPanel,"Center");
(southPanel,"South");
(northPanel,"North");
(new GridLayout(6,5));
for(int cols = 0;cols < 6;cols++){
for(int rows = 0;rows < 5;rows++ ){
diamondsButton[cols][rows]=new JButton((grid[cols+1][rows+1]));
diamondsButton[cols][rows].addActionListener(this);
(diamondsButton[cols][rows]);
}
}
exitButton=new JButton("退出");
(this);
resetButton=new JButton("重列");
r