Class Simulation

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--Simulation

public class Simulation
extends java.awt.Canvas
implements java.lang.Runnable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Simulation Canvas
Main work class of simulator

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Simulation(Clock c, ControlPanel p, StatusLine s)
           
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
Not used
 void mouseDragged(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
In user input mode, while dragging, new dynamics is computed each time
 void mouseEntered(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
Not used
 void mouseExited(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
Not used
 void mouseMoved(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
Not used
 void mousePressed(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
In user input mode sets new starting position
 void mouseReleased(java.awt.event.MouseEvent me)
          Implemets MouseListener, MouseMotionListener Inteface
Switches from user input mode to simulation mode
 void paint(java.awt.Graphics g)
          Redefined Canvas.paint.
 void run()
          Implemets Runnable Interface
Loop scans for parameters.
 void update(java.awt.Graphics g)
          Redefined Canvas.update
Draws objects on canvas
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, checkImage, checkImage, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Simulation

public Simulation(Clock c,
                  ControlPanel p,
                  StatusLine s)
Method Detail

paint

public void paint(java.awt.Graphics g)
Redefined Canvas.paint. Does nothing, only allocates offscreen image
Overrides:
paint in class java.awt.Canvas

update

public void update(java.awt.Graphics g)
Redefined Canvas.update
Draws objects on canvas
Overrides:
update in class java.awt.Component

run

public void run()
Implemets Runnable Interface
Loop scans for parameters. If is normal animation mode, then repaints canvas. Then calls clock to wait until next clock cycle
Specified by:
run in interface java.lang.Runnable

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
In user input mode, while dragging, new dynamics is computed each time
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
In user input mode sets new starting position
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
Switches from user input mode to simulation mode
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
Not used
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
Not used
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
Not used
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)
Implemets MouseListener, MouseMotionListener Inteface
Not used
Specified by:
mouseExited in interface java.awt.event.MouseListener