Class BoardPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class BoardPanel extends JPanel
Display the board.
See Also:
  • Field Details

    • icons

      public static final UIDefaults icons
      The image icons.
    • board

      protected IBoard board
      The board to visualize.
    • rescale

      protected boolean rescale
      Indicates if an image rescaling is necessray.
    • wp_image

      protected Image wp_image
      The white piece image.
    • rp_image

      protected Image rp_image
      The red piece image.
    • ef_image

      protected Image ef_image
      The empty field image.
    • white_piece

      protected JLabel white_piece
      The component to display white pieces.
    • red_piece

      protected JLabel red_piece
      The component to display white pieces.
    • empty_field

      protected JLabel empty_field
      The component to display white pieces.
    • listeners

      protected List listeners
      The listeners.
    • movecnt

      protected int movecnt
      The move count (to detect takebacks).
    • last

      protected Move last
      The last move (if any).
  • Constructor Details

    • BoardPanel

      public BoardPanel(IBoard board)
      Create a new board panel.
  • Method Details

    • update

      public void update(PropertyChangeEvent evt)
      Update the gui after a move.
    • paintComponent

      protected void paintComponent(Graphics g)
      Overridden paint method.
      Overrides:
      paintComponent in class JComponent
    • drawArrow

      protected void drawArrow(Graphics g, Move move, double cellw, double cellh)
      Draw an arrow for visulizing the move.
    • addActionListener

      public void addActionListener(ActionListener listener)
      Add a new action listener.
      Parameters:
      listener - The listener.
    • removeActionListener

      public void removeActionListener(ActionListener listener)
      Remove an action listener.
      Parameters:
      listener - The listener.
    • main

      public static void main(String[] args)
      Main for testing.