消消乐java_java消消乐

packagegame消消乐;importjava.awt.BorderLayout;importjava.awt.FlowLayout;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.MouseAdapter;importjava.awt.event.MouseEvent;importjava.util.Random;import javax.swing.*;public class Myjframe extendsJFrame {private JPanel panel1 = newJPanel();private JButton buttona = new JButton("开始");private JLabel label1 = new JLabel("分数");private JTextField textarea1 = new JTextField(10);private JLabel buttonc = new JLabel("时间");private JProgressBar jindu = newJProgressBar();private Timer timer; //定时器

private JButton buttonb = new JButton("退出");private JPanel panel2 = newJPanel();private JButton button[][] = new JButton[8][8];private int animal[][] = new int[8][8];private ImageIcon Iocn[] = new ImageIcon[7];//标记是否有三个以上的连接

private final int EMPTY = 0;//无为0,有为1//随机数

private Random rand = new Random();//new 一个监听器//标记是否有三个以上的连接

private booleanisThreeLinked;//标记单击次数

private booleanisDoubleClicked;private int x1;//记录第一次被点击按钮的X坐标

private int y1;//记录第一次被点击按钮的Y坐标

private int grade = 0; //得分

Myjframe() {//加载图片

Iocn[0] = new ImageIcon("image//cat.png");

Iocn[1] = new ImageIcon("image//cattle.png");

Iocn[2] = new ImageIcon("image//chicken.png");

Iocn[3] = new ImageIcon("image//fox.png");

Iocn[4] = new ImageIcon("image//monkey.png");

Iocn[5] = new ImageIcon("image//panda.png");

Iocn[6] = new ImageIcon("image//frog.png");

panel1.setLayout(newFlowLayout());

panel1.add(buttona);

panel1.add(label1);

panel1.add(textarea1);

textarea1.setEditable(false);

textarea1.setText(Integer.toString(grade));//panel1.add(buttonc);

jindu.setMaximum(100);

panel1.add(jindu);

panel1.add(buttonb);this.setLayout(newBorderLayout());this.add(panel1, BorderLayout.NORTH);

panel2.setLayout(new GridLayout(8, 8, 1, 1));

MyListener mylisten= newMyListener();intm

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值