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 classKeyBufferer.KBDeckVisitor -
Field Summary
-
Constructor Summary
Constructors Constructor Description KeyBufferer() -
Method Summary
Modifier and Type Method Description voidadd(Buildable b)Adds a child component.voidaddTo(Buildable b)Adds this component to its parent.voidbuild(Element e)Build the objectprotected PieceVisitorDispatchercreateDragSelector(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 piecesvoiddraw(Graphics g, Map map)booleandrawAboveCounters()ElementgetBuildElement(Document doc)voidmouseDragged(MouseEvent e)Sets the new location of the selection rectangle.voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)protected voidrepaintSelectionRect()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:BuildableAdds 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:BuildableAdds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)are invoked when adding a child to a parent -
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Returns:
- an XML element from which this component can be built
-
build
Description copied from interface:BuildableBuild the object -
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMouseAdapter
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin 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:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classMouseAdapter
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classMouseAdapter
-
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCountersin interfaceDrawable
-