Commit 4faf766d authored by YuFan Jia's avatar YuFan Jia 💤
Browse files

feat( b):

parent cc6eff63
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public class ChessBoardPanel extends JPanel {

    public void autoZoom(int width, int height) {// zoom
        this.setSize(chessBoard[0][0].getPreferredSize());
        System.out.println("board\t" + this.getWidth() + "\t" + this.getHeight());
        // System.out.println("board\t" + this.getWidth() + "\t" + this.getHeight());
    }

    public void setChess(int row, int col, ChessPiece chess) {// 在指定格子放棋
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class ChessPanel extends BasicComponent {
    public Dimension getPreferredSize() {
        Dimension space = getParent().getParent().getSize();
        int length = 8 * (Math.min(space.width / 8, space.height / 8));
        System.out.println(space.width + "\t" + space.height + "\t" + length);
        // System.out.println(space.width + "\t" + space.height + "\t" + length);
        return new Dimension(length, length);
    }

@@ -69,7 +69,7 @@ public class ChessPanel extends BasicComponent {
        ImageIcon imgZoomed = new ImageIcon(newimg); // transform it back

        imgZoomed.paintIcon(this, g, 0, 0);
        System.out.println(width);
        // System.out.println(width);
    }

    private void paintChess(ChessPiece playersChess) {// 画棋子