Klasse ChessBoard


public class ChessBoard extends Table
Represents a chess board.
  • Felddetails

    • START_X_POS

      private static final int START_X_POS
      Siehe auch:
    • START_Y_POS

      private static final int START_Y_POS
      Siehe auch:
    • BORDER

      private static final int BORDER
      Siehe auch:
    • board

      private boolean[][] board
    • size

      private int size
    • cellWidth

      private int cellWidth
    • cellHeight

      private int cellHeight
    • marking

      private String marking
  • Konstruktordetails

    • ChessBoard

      public ChessBoard(boolean[][] board, int width, int height, String marking)
      Creates a new ChessBoard.
      Parameter:
      board - The 2-dimensional array which represents the chess board.
      width - Width of the whole chess board.
      height - Height of the whole chess board.
  • Methodendetails

    • calculateCellHeigth

      private void calculateCellHeigth(int width, int height, int size)
      Calculates the height and width of a cell dependent of the height and width of the whole chess board and the number of cells.
      Parameter:
      width - Width of the chess board.
      height - Height of the chess board.
      size - Number of cells in one row/column
    • draw

      public void draw(Graphics g)
      Beschreibung aus Klasse kopiert: VisualizationElement
      Draws the visualization element.
      Setzt außer Kraft:
      draw in Klasse Table
      Parameter:
      g - The Graphics object to draw the element to the DrawArea.
    • setBoard

      public void setBoard(boolean[][] board)
      Parameter:
      board - the board to set
    • getBoard

      public boolean[][] getBoard()
      Gibt zurück:
      the board
    • setSize

      public void setSize(int size)
      Parameter:
      size - the size to set
    • getSize

      public int getSize()
      Gibt zurück:
      the size
    • getCellWidth

      public int getCellWidth()
      Gibt zurück:
      the width of a cell
    • setCellWidth

      public void setCellWidth(int cellWidth)
      Parameter:
      cellWidth -
    • getCellHeight

      public int getCellHeight()
      Gibt zurück:
      the height of a cell
    • setCellHeight

      public void setCellHeight(int cellHeight)
      Parameter:
      cellHeight -
    • getMarking

      public String getMarking()
      Gibt zurück:
      the marking
    • setMarking

      public void setMarking(String marking)
      Parameter:
      marking - The marking of the chess board.