日期:2014-05-20 浏览次数:20678 次
import java.awt.geom.*; // 边框 Rectangle2D.Double border = new Rectangle2D.Double(.....); // 中间的横纵线 Line2D.Double hline1 = new Line2D.Double(...); Line2D.Double hline2 = .... ... Line2D.Double hlineN = .... Line2D.Double vline1 = .... Line2D.Double vline2 = .... ... Line2D.Double vlineN = .... // 组合起来 Area board = new Area(border); board.add(new Area(hline1)); .... board.add(new Area(vlineN)); // paint Graphics2D g2d = (Graphics2D)g; g2d.setPaint(Color.BLACK); g2d.draw(board);
------解决方案--------------------
记得我做的时候,是在一张背景图上画好线(如果背景图上有线的话难以把握位置),再根据坐标及行列间距计算出落子位置即可