net.java.dev.joode.graphics2D.tool
Class ForceTool

java.lang.Object
  extended by net.java.dev.joode.graphics2D.tool.AbstractTool
      extended by net.java.dev.joode.graphics2D.tool.ForceTool
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, ViewTool, WorldStepListener

public class ForceTool
extends AbstractTool

graphicaly applies a force to a body at a specific point on the body

Author:
s0570397

Field Summary
 float scalingFactor
          the differece between the current cursor position and the anchor point is scaled by the scaling factor to produce a force vector to apply at the anchor point
 
Fields inherited from class net.java.dev.joode.graphics2D.tool.AbstractTool
tools
 
Constructor Summary
ForceTool()
           
 
Method Summary
 void activate()
          Tells the tool that it has been activated (i.e.
 void deactivate()
          Tells the tool that it has been deactivate (i.e.
 javax.swing.Icon getIcon()
          returns null, subclasses should probably overide this
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void notifyQuickStep(World w, float stepSize)
          the world has quickstepped
 void notifyStep(World w, float stepSize)
          the world has stepped
 void step()
           
 
Methods inherited from class net.java.dev.joode.graphics2D.tool.AbstractTool
getLabel, install, mouseClicked, mouseEntered, mouseExited, mouseMoved, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scalingFactor

public float scalingFactor
the differece between the current cursor position and the anchor point is scaled by the scaling factor to produce a force vector to apply at the anchor point

Constructor Detail

ForceTool

public ForceTool()
Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class AbstractTool

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class AbstractTool

step

public void step()

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class AbstractTool

notifyQuickStep

public void notifyQuickStep(World w,
                            float stepSize)
Description copied from interface: WorldStepListener
the world has quickstepped

Specified by:
notifyQuickStep in interface WorldStepListener
Overrides:
notifyQuickStep in class AbstractTool

notifyStep

public void notifyStep(World w,
                       float stepSize)
Description copied from interface: WorldStepListener
the world has stepped

Specified by:
notifyStep in interface WorldStepListener
Overrides:
notifyStep in class AbstractTool

activate

public void activate()
Description copied from interface: ViewTool
Tells the tool that it has been activated (i.e. it is now the selected tool and should expect event notifications)

Specified by:
activate in interface ViewTool
Overrides:
activate in class AbstractTool

deactivate

public void deactivate()
Description copied from interface: ViewTool
Tells the tool that it has been deactivate (i.e. another tool has been selected) The tool should reset its state at this point

Specified by:
deactivate in interface ViewTool
Overrides:
deactivate in class AbstractTool

getIcon

public javax.swing.Icon getIcon()
Description copied from class: AbstractTool
returns null, subclasses should probably overide this

Specified by:
getIcon in interface ViewTool
Overrides:
getIcon in class AbstractTool
Returns: