Package VASSAL.build.module.map
Class KeyBufferer
java.lang.Object
java.awt.event.MouseAdapter
VASSAL.build.module.map.KeyBufferer
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,MouseWheelListener
,EventListener
,Buildable
,Drawable
public class KeyBufferer extends MouseAdapter implements Buildable, MouseMotionListener, Drawable
This component listens for mouse clicks on a map and draws the selection
rectangle. ...
If the user clicks on a
GamePiece
, that piece is added to the
KeyBuffer
. draw(Graphics, Map)
is responsible for
drawing the mouse selection rectangle, and
mouseDragged(MouseEvent)
is responsible for triggering repaint
events as the selection rectangle is moved.-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
KeyBufferer.KBDeckVisitor
-
Field Summary
-
Constructor Summary
Constructors Constructor Description KeyBufferer()
-
Method Summary
Modifier and Type Method Description void
add(Buildable b)
Adds a child component.void
addTo(Buildable b)
Adds this component to its parent.void
build(Element e)
Build the objectprotected PieceVisitorDispatcher
createDragSelector(boolean selecting, boolean altDown, Rectangle mapsel)
This PieceVisitorDispatcher determines what to do with pieces on the map when the player finished dragging a rectangle to select piecesvoid
draw(Graphics g, Map map)
boolean
drawAboveCounters()
Element
getBuildElement(Document doc)
void
mouseDragged(MouseEvent e)
Sets the new location of the selection rectangle.void
mouseMoved(MouseEvent e)
void
mousePressed(MouseEvent e)
void
mouseReleased(MouseEvent e)
protected void
repaintSelectionRect()
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseExited, mouseWheelMoved
-
Field Details
-
map
-
selection
-
anchor
-
color
-
thickness
protected int thickness -
bandSelectPiece
-
-
Constructor Details
-
KeyBufferer
public KeyBufferer()
-
-
Method Details
-
addTo
Description copied from interface:Buildable
Adds this component to its parent. In order to make Buildable objects extensible, the child is reponsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class. -
add
Description copied from interface:Buildable
Adds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)
are invoked when adding a child to a parent -
getBuildElement
- Specified by:
getBuildElement
in interfaceBuildable
- Returns:
- an XML element from which this component can be built
-
build
Description copied from interface:Buildable
Build the object -
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classMouseAdapter
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in classMouseAdapter
-
createDragSelector
protected PieceVisitorDispatcher createDragSelector(boolean selecting, boolean altDown, Rectangle mapsel)This PieceVisitorDispatcher determines what to do with pieces on the map when the player finished dragging a rectangle to select pieces- Returns:
-
repaintSelectionRect
protected void repaintSelectionRect() -
mouseDragged
Sets the new location of the selection rectangle.- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classMouseAdapter
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Overrides:
mouseMoved
in classMouseAdapter
-
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCounters
in interfaceDrawable
-