jfreerails.client.view
Class StationPlacementCursor
java.lang.Object
javax.swing.event.MouseInputAdapter
jfreerails.client.view.StationPlacementCursor
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener
public class StationPlacementCursor
- extends javax.swing.event.MouseInputAdapter
This class implements a cursor which can be used to place a station on the
map. Mode of operation:
- User selects a station to place, which sets the current cursor to the
station placement cursor.
- User highlights desired build location with the mouse, boundary of the
station radius is highlighted. If the station cannot be built, the boundary
highlights in red.
- User places station with the left mouse button.
- User may cancel placement by using the right mouse button
- Cursor fires the actionPerformed causing the station to be built.
When the StationBuildAction is no longer enabled, the owner reverts to the
regular cursor type. TODO scroll the area when the mouse hovers at the edge
of the map.
- Author:
- rob
Methods inherited from class javax.swing.event.MouseInputAdapter |
mouseDragged, mousePressed, mouseReleased |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buildActionListener
private final java.beans.PropertyChangeListener buildActionListener
buildEnabled
private boolean buildEnabled
mapView
private final MapViewJComponent mapView
scale
private final float scale
stationBuildModel
private final StationBuildModel stationBuildModel
stationRadiusRenderer
private final StationRadiusRenderer stationRadiusRenderer
StationPlacementCursor
private StationPlacementCursor(ActionRoot actionRoot,
StationRadiusRenderer srr,
MapViewJComponent mapView)
wireUp
public static void wireUp(ActionRoot actionRoot,
StationRadiusRenderer srr,
MapViewJComponent mapView)
init
private void init()
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
- Overrides:
mouseClicked
in class javax.swing.event.MouseInputAdapter
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
- Overrides:
mouseEntered
in class javax.swing.event.MouseInputAdapter
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
- Overrides:
mouseExited
in class javax.swing.event.MouseInputAdapter
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
- Overrides:
mouseMoved
in class javax.swing.event.MouseInputAdapter