下载此文档

Java五子棋 源代码.doc


文档分类:IT计算机 | 页数:约10页 举报非法文档有奖
1/10
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/10 下载此文档
文档列表 文档介绍
一、实践目标: 1. 掌握 Java G UI 界面设计 2. 掌握鼠标响应事件( MouseMotionListener ) 二、实践内容: 设计一个简单的五子棋程序,能够实现五子棋下棋过程。如下图所示 1. 五子棋棋盘类部分源代码如下: 项目全部源代码/?post=162 ?.; ?? import ; ? import ; ? import ; ? import ; ? import ; ? import ; ? import ; ?? import ; ?? import ; ?? import ; ?? import ; ?? import ; ?? import ; ???? import .*; ??/** ??* 五子棋-- 棋盘类??*/ ???? public class ChessBoard extends JPanel implements MouseListener { ?? public static final int MARGIN= 30; // 边距?? public static final int GRID_SPAN= 35; // 网格间距?? public static final int ROWS= 15; // 棋盘行数?? public static final int COLS= 15; // 棋盘列数???? Point[] chessList= new Point[(ROWS+ 1 )*(COLS+ 1 )]; // 初始每个数组元素为 null ?? boolean isBlack= true ; // 默认开始是黑棋先?? boolean gameOver= false ; // 游戏是否结束?? int chessCount; // 当前棋盘棋子的个数?? int xIndex,yIndex; // 当前刚下棋子的索引???? Image img; ?? Image shadows; ?? Color colortemp; ?? public ChessBoard(){ ????// setBackground();// 设置背景色为橘黄色?? img=().getImage( "" ); ?? shadows=().getImage( "" ); ?? addMouseListener( this ); ?? addMouseMotionL

Java五子棋 源代码 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数10
  • 收藏数0 收藏
  • 顶次数0
  • 上传人mh900965
  • 文件大小355 KB
  • 时间2016-08-27