资源说明:用Java实现的中国象棋,包括源码和可执行文件(chess.jar 直接运行)。
package chess;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JLabel;
/**
* 位置类,表示棋盘上的一个位置,能包含一个棋子
*
* @author 徐磊
*/
public class ChessPoint extends JLabel {
private Chessman chessman;
public final int x; // X轴坐标
public final int y; // y轴坐标
public final int width;//在棋盘上的真实位置横坐标
public final int heiget;//在棋盘上的真实位置纵坐标
private ChessBoard board;
public ChessPoint(ChessBoard board, int pointX, int pointY) {
board.add(this);
super.setSize(40, 40);
super.setLocation(pointX, pointY);
super.setBounds(pointX - 20, pointY - 20, 40, 40);
super.setText(" ");
super.setForeground(Color.white);
super.setFont(new Font("隶书", Font.BOLD, 35));
this.x = -1;
this.y = -1;
this.width = pointX;
this.heiget = pointY;
this.board = board;
}
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。