nl.tudelft.simulation.dsol.gui.animation2D.mouse
Class InputListener

java.lang.Object
  extended by nl.tudelft.simulation.dsol.gui.animation2D.mouse.InputListener
All Implemented Interfaces:
KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, EventListener
Direct Known Subclasses:
EditorInputListener

public class InputListener
extends Object
implements MouseListener, MouseWheelListener, MouseMotionListener, KeyListener

A InputListener
(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:23:36 $
Author:
Peter Jacobs

Field Summary
protected  DSOLApplicationInterface application
          the simulator to control
protected  Point2D mouseClicked
          the mouseClicked point in screen coordinates
protected  AnimationPanel panel
          the panel to use
 
Constructor Summary
InputListener(DSOLApplicationInterface application, AnimationPanel panel)
          constructs a new InputListener
 
Method Summary
protected  Object getSelectedObject(List targets)
          edits a selected Renderable2D
protected  List getSelectedObjects(Point2D mousePoint)
          returns the list of selected objects at a certain mousePoint
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent mouseEvent)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseWheelMoved(MouseWheelEvent e)
           
protected  void pan(Point2D mouseClickedPoint, Point2D mouseReleasedPoint)
          What to do if the middle mouse button was released
protected  void popup(MouseEvent e)
          popsup on a mouseEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

application

protected DSOLApplicationInterface application
the simulator to control


panel

protected AnimationPanel panel
the panel to use


mouseClicked

protected Point2D mouseClicked
the mouseClicked point in screen coordinates

Constructor Detail

InputListener

public InputListener(DSOLApplicationInterface application,
                     AnimationPanel panel)
constructs a new InputListener

Parameters:
application - the application
panel - the panel
Method Detail

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener
See Also:
#mouseClicked(java.awt.event.MouseEvent)

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
See Also:
MouseListener.mousePressed(java.awt.event.MouseEvent)

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
See Also:
MouseListener.mouseReleased(java.awt.event.MouseEvent)

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener
See Also:
MouseListener.mouseEntered(java.awt.event.MouseEvent)

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
See Also:
MouseListener.mouseExited(java.awt.event.MouseEvent)

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface MouseWheelListener
See Also:
MouseWheelListener.mouseWheelMoved(java.awt.event.MouseWheelEvent)

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
See Also:
MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)

mouseMoved

public void mouseMoved(MouseEvent mouseEvent)
Specified by:
mouseMoved in interface MouseMotionListener
See Also:
MouseMotionListener.mouseMoved(java.awt.event.MouseEvent)

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener
See Also:
KeyListener.keyPressed(java.awt.event.KeyEvent)

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener
See Also:
KeyListener.keyReleased(java.awt.event.KeyEvent)

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener
See Also:
KeyListener.keyTyped(java.awt.event.KeyEvent)

pan

protected void pan(Point2D mouseClickedPoint,
                   Point2D mouseReleasedPoint)
What to do if the middle mouse button was released

Parameters:
mouseClickedPoint - the point where the mouse was clicked
mouseReleasedPoint - the point where the mouse was released

getSelectedObjects

protected List getSelectedObjects(Point2D mousePoint)
returns the list of selected objects at a certain mousePoint

Parameters:
mousePoint - the mousePoint
Returns:
the selected objects

popup

protected void popup(MouseEvent e)
popsup on a mouseEvent

Parameters:
e - the mouseEvent

getSelectedObject

protected Object getSelectedObject(List targets)
edits a selected Renderable2D

Parameters:
targets - which are selected by the mouse.
Returns:
the selected Object (e.g. the one with the highest zValue).


Copyright © 2002-2010 Delft University of Technology, the Netherlands. All Rights Reserved.