s ActionListener { public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); //System.out.println("you have pressed a area"); if (obj == Chess[Max - 1][1]) { System.exit(1); }//退出按钮 if (obj == Chess[Max - 1][2]) { new Reset(); }//退出按钮 if (obj == Chess[Max - 1][3])//让步按钮 { if (IamFirst == false)//如果白棋让步 { IamFirst = true; Chess[0][0].setBackground(Color.red); Chess[0][Max-2].setBackground(Color.white); } else //如果黑棋让步 { IamFirst = false; Chess[0][0].setBackground(Color.white); Chess[0][Max-2].setBackground(Color.red); } } if(obj == Chess[Max - 1][4])//如果按裁判按钮,计算成绩 { int M1 = 0, M2 = 0; M1 = Integer.parseInt(Chess[0][1].getText()); M2 = Integer.parseInt(Chess[0][Max - 1].getText()); if (M1>M2){ System.out.println("黑棋胜"); msg = new String("裁判郑重宣布:\n胜利方为黑棋!\n恭喜恭喜!黑棋取得胜利!继续努力吧!\n白棋不要气馁,再接再厉!"); JOptionPane.showOptionDialog(null,
上一篇:
魔方java源代码_java代码
下一篇:
用于土木工程结构抗震的半主动调谐质量阻尼器