Class GUIHex<H extends Hex>

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
GUIBattleHex, GUIMasterHex

public abstract class GUIHex<H extends Hex> extends JComponent
Abstract parent class for various GUI hexes
See Also:
  • Field Details

    • SQRT3

      public static final double SQRT3
    • model

      private H extends Hex model
    • xVertex

      double[] xVertex
    • yVertex

      double[] yVertex
    • len

      double len
    • hexagon

      GeneralPath hexagon
    • rectBound

      Rectangle rectBound
    • antialias

      static boolean antialias
      Globally turns antialiasing on or off for all hexes.
    • useOverlay

      static boolean useOverlay
      Globally turns overlay on or off for all hexes
    • selected

      private boolean selected
  • Constructor Details

    • GUIHex

      public GUIHex(H model)
  • Method Details

    • getHexModel

      public H getHexModel()
    • setHexModel

      public void setHexModel(H model)
    • getBounds

      public Rectangle getBounds()
      Overrides:
      getBounds in class Component
    • contains

      public boolean contains(Point point)
      Overrides:
      contains in class Component
    • select

      public void select()
    • unselect

      public void unselect()
    • setSelected

      public void setSelected(boolean selected)
    • isSelected

      public boolean isSelected()
    • getAntialias

      static boolean getAntialias()
    • setAntialias

      static void setAntialias(boolean enabled)
    • getOverlay

      static boolean getOverlay()
    • setOverlay

      public static void setOverlay(boolean enabled)
    • makePolygon

      static GeneralPath makePolygon(int sides, double[] x, double[] y, boolean closed)
      Return a GeneralPath polygon, with the passed number of sides, and the passed x and y coordinates. Close the polygon if the argument closed is true.
    • findCenter

      public Point findCenter()
      Return the Point closest to the center of the polygon.
    • findCenter2D

      Point2D.Double findCenter2D()
      Return the Point2D.Double at the center of the polygon.
    • getCliffOrArrowsPositionXArray

      protected double[] getCliffOrArrowsPositionXArray(int j, double vx1, double vx2, double theta)
    • getCliffOrArrowsPositionYArray

      protected double[] getCliffOrArrowsPositionYArray(int j, double vy1, double vy2, double theta)
    • getWallOrSlopePositionXArray

      protected double[] getWallOrSlopePositionXArray(int j, double vx1, double vx2, double theta, int size)
    • getWallOrSlopePositionYArray

      protected double[] getWallOrSlopePositionYArray(int j, double vy1, double vy2, double theta, int size)