![](https://box.kancloud.cn/f929a2208cbf2e51ec0f1629f8fdeb33_646x324.png)
QiZi.java
~~~
import java.awt.*;
public class QiZi {
private Color color;//棋子的颜色
private String name;//棋子的名字,即是什么棋
private int x;//所在的x方向位置
private int y;//所在的y方向位置
private boolean focus=false;//是否被选中
public QiZi()
{
}
public QiZi(Color color, String name, int x, int y)
{//构造器
this.color=color;
this.name=name;
this.x=x;
this.y=y;
this.focus=false;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public boolean isFocus() {
return focus;
}
public void setFocus(boolean focus) {
this.focus = focus;
}
public boolean getFocus()//判断棋子是否被选中的方法
{
return focus;
}
}
~~~