运行一下

### 绘制棋盘
**重写paint方法**
@Override
public void paint(java.awt.Graphics g) {
super.paint(g);
}
**绘制横竖相交接的线**
定义15行、15列
public static final int ROWS=15;
public static final int COLS=15;
**绘制网格**
//绘制网格
private void drawGrid(Graphics g) {
Graphics2D g_2d=(Graphics2D)g;
int start=26;
int x1=start;
int y1=20;
int x2=586;
int y2=20;
for (int i = 0; i < ROWS; i++) {
y1 = start + 40*i;
y2 = y1;
g_2d.drawLine(x1, y1, x2, y2);
}
y1=start;
y2=586;
for (int i = 0; i < COLS; i++) {
x1 = start + 40\*i;
x2 = x1;
g_2d.drawLine(x1, y1, x2, y2);
}
}
**绘制5个圆点**
//绘制5个黑点
private void draw5Point(Graphics g) {
//第1个点
g.fillArc(142, 142, 8, 8, 0, 360);
//第2个点
g.fillArc(462, 142, 8, 8, 0, 360);
//第3个点
g.fillArc(142, 462, 8, 8, 0, 360);
//第4个点
g.fillArc(462, 462, 8, 8, 0, 360);
//中心点
g.fillArc(302, 302, 8, 8, 0, 360);
}
**在paint方法里面调用以上2个方法**
@Override
public void paint(java.awt.Graphics g) {
super.paint(g);
//绘制网格
drawGrid(g);
//绘制5个黑点
draw5Point(g);
}
**棋盘已经绘制完成**

### 实现落子指示器
1. 创建指示器类
package main;
import java.awt.Color;
import java.awt.Graphics;
//指示器类
public class Pointer {
private int i=0;//二维下标i
private int j=0;//二维下标j
private int x=0;//坐标X
private int y=0;//坐标Y
private GamePanel panel=null;
private Color color=null;
private int h=40;//指示的大小
private boolean isShow=false;//是否展示
private int qizi = 0 ;//棋子类型 0:无 1:白棋 2:黑棋
public Pointer(int x,int y,int i,int j,Color color,GamePanel panel){
this.x=x;
this.y=y;
this.i=i;
this.j=j;
this.panel=panel;
this.color=color;
}
//绘制
void draw(Graphics g){
Color oColor = g.getColor();
if(color!=null){
g.setColor(color);
}
if(isShow){
//绘制指示器
g.drawRect(x-h/2, y-h/2, h, h);
}
if(color!=null){//用完设置回去颜色
g.setColor(oColor);
}
}
//判断鼠标是否在指针范围内
boolean isPoint(int x,int y){
//大于左上角,小于右下角的坐标则肯定在范围内
if(x>this.x-h/2 && y >this.y-h/2
&& x<this.x+h/2 && y <this.y+h/2){
return true;
}
return false;
}
public boolean isShow() {
return isShow;
}
public void setShow(boolean isShow) {
this.isShow = isShow;
}
public int getQizi() {
return qizi;
}
public void setQizi(int qizi) {
this.qizi = qizi;
}
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 int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public int getJ() {
return j;
}
public void setJ(int j) {
this.j &#