Class DragListener

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

    public final class DragListener
    extends java.awt.event.MouseAdapter
    A DragListener should be attached to Swing components that have a TransferHandler attached. The DragListener will make sure that the Swing component to which it is attached is draggable (moveable to be precise).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private FreeColClient freeColClient
      The enclosing client.
      private static java.util.logging.Logger logger  
      private static int maxWindowHeight
      The maximum numbers of pixels of the user's screen height before triggering the small flag.
      private FreeColPanel parentPanel
      The panel within which the drag occurs.
      private static boolean small
      Whether the user's screen height is smaller than the maximum height allowed
      private static int windowHeight
      The user's screen height.
      private boolean windows
      Enable windows workaround.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void mousePressed​(java.awt.event.MouseEvent e)
      Gets called when the mouse was pressed on a Swing component that has this object as a MouseListener.
      • Methods inherited from class java.awt.event.MouseAdapter

        mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, mouseWheelMoved
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • maxWindowHeight

        private static final int maxWindowHeight
        The maximum numbers of pixels of the user's screen height before triggering the small flag.
        See Also:
        Constant Field Values
      • windowHeight

        private static final int windowHeight
        The user's screen height.
      • small

        private static final boolean small
        Whether the user's screen height is smaller than the maximum height allowed
      • windows

        private final boolean windows
        Enable windows workaround.
      • freeColClient

        private final FreeColClient freeColClient
        The enclosing client.
      • parentPanel

        private final FreeColPanel parentPanel
        The panel within which the drag occurs.
    • Constructor Detail

      • DragListener

        public DragListener​(FreeColClient freeColClient,
                            FreeColPanel parentPanel)
        The constructor to use.
        Parameters:
        freeColClient - The FreeColClient for the game.
        parentPanel - The layered pane that contains the components to which a DragListener might be attached.
    • Method Detail

      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Gets called when the mouse was pressed on a Swing component that has this object as a MouseListener.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class java.awt.event.MouseAdapter
        Parameters:
        e - The event that holds the information about the mouse click.