Package net.sf.freecol.client.gui
Class AbstractCanvasListener
- java.lang.Object
-
- net.sf.freecol.client.control.FreeColClientHolder
-
- net.sf.freecol.client.gui.AbstractCanvasListener
-
- Direct Known Subclasses:
CanvasMapEditorMouseListener,CanvasMouseMotionListener,MenuMouseMotionListener
public class AbstractCanvasListener extends FreeColClientHolder
The outline of a canvas listener.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intAUTO_SCROLL_SPACESpace to auto-scroll.private static intDRAG_SCROLL_SPACESpace to drag-scroll.private static ScrollThreadscrollThreadThe scroll thread itself.private static java.lang.ObjectscrollThreadLock
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCanvasListener(FreeColClient freeColClient)Create a new AbstractCanvasListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidperformAutoScrollIfActive(java.awt.event.MouseEvent e, boolean ignoreTop)Auto-scroll to a mouse position if necessary.protected voidperformDragScrollIfActive(java.awt.event.MouseEvent e)Drag-scroll to a mouse position if necessary.private voidscroll(int x, int y, int scrollSpace, boolean ignoreTop)Scroll the map if the given (x,y) coordinate is close to an edge.protected voidstopScrollIfScrollIsActive()Stop scrolling.-
Methods inherited from class net.sf.freecol.client.control.FreeColClientHolder
askServer, currentPlayerIsMyPlayer, getClientOptions, getConnectController, getFreeColClient, getFreeColServer, getGame, getGUI, getMap, getMyPlayer, getSpecification, igc, pgc
-
-
-
-
Field Detail
-
AUTO_SCROLL_SPACE
protected static final int AUTO_SCROLL_SPACE
Space to auto-scroll.- See Also:
- Constant Field Values
-
DRAG_SCROLL_SPACE
private static final int DRAG_SCROLL_SPACE
Space to drag-scroll.- See Also:
- Constant Field Values
-
scrollThread
private static volatile ScrollThread scrollThread
The scroll thread itself.
-
scrollThreadLock
private static volatile java.lang.Object scrollThreadLock
-
-
Constructor Detail
-
AbstractCanvasListener
protected AbstractCanvasListener(FreeColClient freeColClient)
Create a new AbstractCanvasListener.- Parameters:
freeColClient- TheFreeColClientfor the game.
-
-
Method Detail
-
performAutoScrollIfActive
protected void performAutoScrollIfActive(java.awt.event.MouseEvent e, boolean ignoreTop)Auto-scroll to a mouse position if necessary.- Parameters:
e- TheMouseEventthat initiating the scroll.ignoreTop- If the top should be ignored (to avoid scrolling when the mouse is over the top of the map, as the menu bar above is checked already)
-
performDragScrollIfActive
protected void performDragScrollIfActive(java.awt.event.MouseEvent e)
Drag-scroll to a mouse position if necessary.- Parameters:
e- TheMouseEventthat initiating the scroll.
-
stopScrollIfScrollIsActive
protected void stopScrollIfScrollIsActive()
Stop scrolling.
-
scroll
private void scroll(int x, int y, int scrollSpace, boolean ignoreTop)Scroll the map if the given (x,y) coordinate is close to an edge.- Parameters:
x- The x coordinate.y- The y coordinate.scrollSpace- The clearance from the relevant edgeignoreTop- If the top should be ignored
-
-