java五子棋 清除棋子

来源:百度知道 编辑:UC知道 时间:2024/06/24 23:10:26
用java做的五子棋,怎样清除棋盘上的棋子?

//楼主参考一下.

import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.awt.Color;

public class WuZhiqi extends Applet implements ActionListener, MouseListener,
MouseMotionListener, ItemListener {
int color = 0;// 旗子的颜色标识 0:白子 1:黑子

boolean isStart = false;// 游戏开始标志

int bodyArray[][] = new int[16][16]; // 设置棋盘棋子状态 0 无子 1 白子 2 黑子

Button b1 = new Button("游戏开始");

Button b2 = new Button("重置游戏");

Label lblWin = new Label(" ");

Checkbox ckbHB[] = new Checkbox[2];

CheckboxGroup ckgHB = new CheckboxGroup();

public void init() {
setLayout(null);

addMouseListener(this);
add(b1);
b1.setBounds(330, 50, 80, 30);
b1.addActionListener(this);
add(b2);
b2.setBounds(330, 90, 80, 30);
b2.addActionListener(this);
ckbHB[0] = new Checkbox("白子先&q