import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class lianliankan implements ActionListener
{
JFrame mainFrame; // 主面板
JPanel centerPanel,saidPanel; // 子面板
JButton diamondsButton[][] = new JButton[10][10];// 游戏按钮数组
JButton firstButton, secondButton; // 分别记录两次被选中的按钮
JButton backButton, remarkButton, newlyButton, startButton;// 返回,重列,重新,开始|暂停按钮
JLabel lable1 = new JLabel("分数:");
JLabel lable2 = new JLabel("0"); // 分数标签
int grid[][] = new int[12][12];
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 AddGif()
{
for (int cols = 0; cols < 10; cols++)
{
for (int rows = 0; rows < 10; rows++)
{
diamondsButton[cols][rows] = new JButton(new ImageIcon(String.valueOf(grid[cols + 1][rows + 1])+".gif"));
diamondsButton[cols][rows].addActionListener(this);
centerPanel.add(diamondsButton[cols][rows]);
}
}
}
public void create()
{
mainFrame = new JFrame("连连看");
mainFrame.setLayout(null);
centerPanel = new JPanel();
saidPanel = new JPanel();
saidPanel.setLayout(null);
saidPanel.setBackground(Color.yellow);
centerPanel.setLayout(new GridLayout(10,10)); //10*10的网格布局