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 int
AUTO_SCROLL_SPACE
Space to auto-scroll.private static int
DRAG_SCROLL_SPACE
Space to drag-scroll.private static ScrollThread
scrollThread
The scroll thread itself.private static java.lang.Object
scrollThreadLock
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCanvasListener(FreeColClient freeColClient)
Create a new AbstractCanvasListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
performAutoScrollIfActive(java.awt.event.MouseEvent e, boolean ignoreTop)
Auto-scroll to a mouse position if necessary.protected void
performDragScrollIfActive(java.awt.event.MouseEvent e)
Drag-scroll to a mouse position if necessary.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.protected void
stopScrollIfScrollIsActive()
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
- TheFreeColClient
for 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
- TheMouseEvent
that 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
- TheMouseEvent
that 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
-
-