Class FieldCell

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

public class FieldCell extends JButton
Cell used in Game Panel for placing Plants Entities. Its bounds are declared inside GamePanel
See Also:
  • Field Details

  • Constructor Details

    • FieldCell

      public FieldCell(GamePanel parent, Pair<Integer,Integer> coord, String text, Controller controller)
      Field Cell Constructor.
      Parameters:
      coord - the central coordinate of the Cell.
      text - the text of the button.
      parent - the parent panel.
      controller - is the controller of the game.
  • Method Details

    • setPlant

      protected void setPlant()
      Set a plant to the cell.
    • cellHover

      protected void cellHover(boolean isHovered)
      Set a plant to the cell.
      Parameters:
      isHovered - if the content area should be filled or not.
    • hasPlant

      protected boolean hasPlant()
      Has the cell a plant?
      Returns:
      if the cell has already a plant.
    • getCoord

      public Pair<Integer,Integer> getCoord()
      Returns the center coordinate of the FieldCell.
      Returns:
      The center coordinate of the Cell