Class ClassicMapControls


  • public final class ClassicMapControls
    extends MapControls
    A collection of panels and buttons that are used to provide the user with a more detailed view of certain elements on the map and also to provide a means of input in case the user can't use the keyboard.
    • Field Detail

      • panel

        private final javax.swing.JPanel panel
        The main panel.
      • arrowFont

        private final java.awt.Font arrowFont
        A font for the buttons.
      • componentList

        private final java.util.List<java.awt.Component> componentList
        Helper container for the abstract API functions.
    • Constructor Detail

      • ClassicMapControls

        public ClassicMapControls​(FreeColClient freeColClient)
        The basic constructor.
        Parameters:
        freeColClient - The FreeColClient for the game.
    • Method Detail

      • makeButton

        private javax.swing.JButton makeButton​(java.lang.String direction,
                                               java.lang.String arrow)
        Makes a JButton for a given arrow direction. By default, the direction and arrow parameters should be the same literal direction, just formatted for a unique context.
        Parameters:
        direction - The Direction on the Map to move
        arrow - The Direction of the arrow itself
        Returns:
        A JButton with the correct display and action
        Since:
        0.10.6
      • initializeUnitButtons

        protected boolean initializeUnitButtons()
        Initialize the unit buttons. Initialization is deferred until in-game and the action manager is available.
        Overrides:
        initializeUnitButtons in class MapControls
        Returns:
        True if initialization occurs.
      • getComponentsToAdd

        public java.util.List<java.awt.Component> getComponentsToAdd​(java.awt.Dimension newSize)
        Prepare and return a list of map controls components to add to the canvas.
        Specified by:
        getComponentsToAdd in class MapControls
        Parameters:
        newSize - The Dimension of the canvas.
        Returns:
        A list of Components to add to the canvas.
      • getComponentsPresent

        public java.util.List<java.awt.Component> getComponentsPresent()
        Prepare and return a list of map controls components to remove from the canvas.
        Specified by:
        getComponentsPresent in class MapControls
        Returns:
        A list of Components to remove from the canvas.