资源简介
java五子棋开发,包括毕业论文,毕业设计,开题报告等
代码片段和文件信息
import java.awt.*;
import java.awt.event.*;
import java.util.Arrays;
import javax.swing.*;
import java.io.*;
public class BoardPanel extends JPanel{
private static Image white = null;
private static Image black = null;
private static int xp; //放置棋子的位置的x坐标
private static int yp; //放置棋子的位置的y坐标
private Cursor handCursor;
private Cursor defaultCursor;
protected static int board[][]; // 记录每一个黑棋或者白棋棋子的位置
private int color=1; // 记录选手的棋子的颜色1=black 2=white
int STEPCOUNTER=0;
int base=5;
int DEEPTH=3;
int MINDEEPTH=3;
int MAX1=5;
long INVALID=9000000;
int chessBoard[][];
//绘制出棋盘x和y轴方向的棋盘线上的数字标号
String line = “a b c d e f g h i j k l m n o“;
char [] rowNum1 = {‘1‘‘2‘‘3‘‘4‘‘5‘‘6‘‘7‘‘8‘‘9‘};
char [] rowNum2={‘1‘‘0‘‘1‘‘1‘‘1‘‘2‘‘1‘‘3‘‘1‘‘4‘‘1‘‘5‘};
public BoardPanel(){
try {
handCursor=new Cursor(12);//手行鼠标
defaultCursor = new Cursor(0);//普通鼠标
board = new int[15][15];
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//绘制整个棋盘界面
public void paint(Graphics gc){
super.paint(gc);
gc.setColor(Color.blue);
gc.drawString(line2515);
for(int i=0;i<9;i++){
gc.drawChars(rowNum1i11035+i*30);
}
for(int i=9j=0;i<15;i++j+=2){
gc.drawChars(rowNum2j21035+i*30);
}
// 绘制棋盘
for (int i = 0; i < 15; i++) {
gc.drawLine(30 30 + i * 30 450 30 + i * 30); //绘制棋盘的行线
gc.drawLine(30 + i * 30 30 30 + i * 30 450); //绘制棋盘的列线
}
gc.drawLine(25 25 455 25);
gc.drawLine(25 25 25 455);
gc.drawLine(25 455 455 455);
gc.drawLine(455 25 455 455);
//当窗体被重画时,将绘制出棋盘重画之前的状态
for(int i=0;i<15;i++){
for (int j = 0; j < 15; j++) {
xp=30+i*30-15;
yp=30+j*30-15;
if (board[i][j] == 1){//在棋盘交叉线上画出黑棋子
gc.setColor(Color.black);
gc.fillOval(xpyp3030);
}
if (board[i][j] == 2){//在棋盘交叉线上画出白棋子
gc.setColor(Color.white);
gc.fillOval(xpyp3030);
}
}
}
}
private void jbInit() throws Exception {
this.addMouseMotionListener(new ChessWZQ_this_mouseMotionAdapter(this));
this.addMouseListener(new ChessWZQ_this_mouseAdapter(this));
}
public int getColor(){
return color;
}
public void setColor(int cr){
color=cr;
}
/**
* 当窗体更新时,清空棋盘
*/
public void clearBoard(){
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..HR 46080 2010-06-11 21:17 源码\五子棋\毕业设计\中期检查表.doc
..A..HR 173056 2010-06-11 21:18 源码\五子棋\毕业设计\任务书.doc
..A..HR 201216 2010-06-11 21:18 源码\五子棋\毕业设计\外文资料翻译.doc
..A..HR 174080 2010-06-11 21:19 源码\五子棋\毕业设计\开题报告.doc
..A..HR 210944 2010-06-11 21:19 源码\五子棋\毕业设计\成绩评定表.doc
..A..HR 677376 2010-06-11 21:15 源码\五子棋\毕业设计\毕业论文.doc
..A..HR 7489 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\BoardPanel$Analyse.class
..A..HR 715 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\BoardPanel$ChessWZQ_this_mouseAdapter.class
..A..HR 735 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\BoardPanel$ChessWZQ_this_mouseMotionAdapter.class
..A..HR 429 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\BoardPanel$Queue.class
..A..HR 8352 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\BoardPanel.class
..A..HR 740 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$1.class
..A..HR 855 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$2.class
..A..HR 829 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$3.class
..A..HR 2017 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$4.class
..A..HR 1640 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$5.class
..A..HR 2070 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$6.class
..A..HR 1779 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ$7.class
..A..HR 15642 2010-05-27 08:44 源码\五子棋\毕业设计\源码\bin\ChessWZQ.class
..A..HR 612 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\Group.class
..A..HR 465 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\Message.class
..A..HR 441 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\Pla
..A..HR 10105 2010-05-27 07:37 源码\五子棋\毕业设计\源码\bin\ServeOneClient.class
..A..HR 11 2010-05-27 07:16 源码\五子棋\毕业设计\源码\bin\Server.bat
..A..HR 1494 2010-05-27 08:16 源码\五子棋\毕业设计\源码\bin\Server.class
..A..HR 27 2010-05-27 07:19 源码\五子棋\毕业设计\源码\bin\玩家1.bat
..A..HR 28 2010-05-27 07:19 源码\五子棋\毕业设计\源码\bin\玩家2.bat
..A..HR 28 2010-05-27 07:20 源码\五子棋\毕业设计\源码\bin\玩家3.bat
..A..HR 25478 2010-05-21 10:45 源码\五子棋\毕业设计\源码\src\BoardPanel.java
..A..HR 28057 2010-05-27 08:44 源码\五子棋\毕业设计\源码\src\ChessWZQ.java
............此处省略15个文件信息
评论
共有 条评论