net.sf.freecol.client.gui
Class CanvasMouseMotionListener

java.lang.Object
  extended by net.sf.freecol.client.gui.CanvasMouseMotionListener
All Implemented Interfaces:
java.awt.event.MouseMotionListener, java.util.EventListener

public final class CanvasMouseMotionListener
extends java.lang.Object
implements java.awt.event.MouseMotionListener

Listens to the mouse being moved at the level of the Canvas.


Nested Class Summary
private  class CanvasMouseMotionListener.ScrollThread
          Scrolls the view of the Map by moving its focus.
 
Field Summary
private static int AUTO_SCROLLSPACE
           
private  Canvas canvas
           
private static int DRAG_SCROLLSPACE
           
private  GUI gui
           
private  Tile lastTile
           
private static java.util.logging.Logger logger
           
private  Map map
           
private  CanvasMouseMotionListener.ScrollThread scrollThread
           
 
Constructor Summary
CanvasMouseMotionListener(Canvas canvas, GUI g, Map m)
          The constructor to use.
 
Method Summary
private  void auto_scroll(int x, int y)
           
private  void drag_scroll(int x, int y)
           
 void mouseDragged(java.awt.event.MouseEvent e)
          Invoked when the mouse has been dragged.
 void mouseMoved(java.awt.event.MouseEvent e)
          Invoked when the mouse has been moved.
private  void scroll(int x, int y, int scrollspace)
           
 
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

lastTile

private Tile lastTile

canvas

private final Canvas canvas

gui

private final GUI gui

map

private final Map map

scrollThread

private CanvasMouseMotionListener.ScrollThread scrollThread

DRAG_SCROLLSPACE

private static final int DRAG_SCROLLSPACE
See Also:
Constant Field Values

AUTO_SCROLLSPACE

private static final int AUTO_SCROLLSPACE
See Also:
Constant Field Values
Constructor Detail

CanvasMouseMotionListener

public CanvasMouseMotionListener(Canvas canvas,
                                 GUI g,
                                 Map m)
The constructor to use.

Parameters:
canvas - The component this object gets created for.
g - The GUI that holds information such as screen resolution.
m - The Map that is currently being drawn on the Canvas (by the GUI).
Method Detail

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse has been moved.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - The MouseEvent that holds all the information.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Invoked when the mouse has been dragged.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - The MouseEvent that holds all the information.

auto_scroll

private void auto_scroll(int x,
                         int y)

drag_scroll

private void drag_scroll(int x,
                         int y)

scroll

private void scroll(int x,
                    int y,
                    int scrollspace)