Class SimpleGamePanel

    • Field Detail

      • inFogColor

        public static final Color inFogColor
        Colour of unknown territory
      • clearColor

        public static final Color clearColor
        Colour of explored territory
      • textColor

        public static final Color textColor
        Colour of regular cell contents
      • flagColor

        public static final Color flagColor
        Colour of flagged spot
      • pickedColor

        public static final Color pickedColor
        Colour of a spot recently picked/flagged
      • deadColor

        public static final Color deadColor
        Colour to depict the place of death of our sweeper
      • winSpiral

        public static final Color winSpiral
        Colour to show the winning spiral in
      • minSpotDimension

        public static final int minSpotDimension
        Defines the minimum height/width of the squares that represent the spots on the gui
        See Also:
        Constant Field Values
      • playArea

        private final JPanel playArea
      • toMonitor

        protected final MineMap toMonitor
      • field

        public final List<List<FlashableJLabel>> field
        This is the visual representation of a MineMap. This is a completely unalterable array so it is always in alignment with MineMap's coordinates. Allows access to the individual visualisation labels on the play area. Thus allows their customisation without changing the main visualisation logic.
      • flashedRow

        private int flashedRow
      • flashedCol

        private int flashedCol
      • disposeAfterRun

        private boolean disposeAfterRun
    • Constructor Detail

      • SimpleGamePanel

        public SimpleGamePanel​(MineMap toMonitor,
                               String title,
                               boolean scale)
        Instantiating a window will immediately show it and starts the monitoring and visualisation process of a given minemap.
        Parameters:
        toMonitor - The map to visualise
        title - The title of this window
        scale - true enable automatically scaling the spots, false if this feature should be disabled
    • Method Detail

      • ensureColour

        private void ensureColour​(FlashableJLabel forWhat,
                                  Color fg,
                                  Color bg)
        Colour changes for a label will be propagated if the current colour is not the same as the one that was requested
        Parameters:
        forWhat - The label for which the change is needed
        fg - The desired foreground (i.e., text) colour
        bg - The desired background colour
      • refreshArea

        private void refreshArea()
        This method updates all labels in the play area to show the state of the map at the time when the method is called.
      • run

        public void run()
        Ensures the window contains the most up to date look of the MineMap.
        Specified by:
        run in interface Runnable
      • setDisposeAfterRun

        protected void setDisposeAfterRun​(boolean disposeAfterRun)