Class DetectorTest

All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class DetectorTest extends JPanel implements MouseListener, MouseMotionListener
See Also:
  • Constructor Details

    • DetectorTest

      public DetectorTest(double x, double y, double w, double h)
      Create a test detector.
      Parameters:
      x -
      y -
      w -
      h -
  • Method Details

    • getRandom

      public static Random getRandom()
      Get the shared random number generator
      Returns:
      the shared random number generator
    • screwballEvent

      public void screwballEvent()
    • nextEvent

      public void nextEvent(boolean repaint)
      Generate the next event.
      Parameters:
      repaint - if true, repaint after getting next event.
    • clearTracks

      public void clearTracks()
      Clear all the tracks.
    • generateTracks

      public void generateTracks()
      Generate some random straightline tracks
    • paintDetector

      public void paintDetector(Graphics g)
      Paint the detector
    • restoreDefaultWorld

      public void restoreDefaultWorld()
    • addChamber

      public void addChamber(Rectangle2D.Double boundary)
      Parameters:
      name - the name of the chamber.
      boundary - the rectangular boundary in world coordinates.
    • mouseDragged

      public void mouseDragged(MouseEvent mouseEvent)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseMoved

      public void mouseMoved(MouseEvent mouseEvent)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseClicked

      public void mouseClicked(MouseEvent mouseEvent)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent mouseEvent)
      The mouse has entered the display area.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      mouseEvent - the causal event.
    • mouseExited

      public void mouseExited(MouseEvent mouseEvent)
      The mouse has exited the display area.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      mouseEvent - the causal event.
    • mousePressed

      public void mousePressed(MouseEvent mouseEvent)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent mouseEvent)
      Specified by:
      mouseReleased in interface MouseListener
    • getDisplayOption

      public DetectorTest.DisplayOption getDisplayOption()
    • setDisplayOption

      public void setDisplayOption(DetectorTest.DisplayOption displayOption)
    • getDisplayOptionMenu

      public JMenu getDisplayOptionMenu()
      Get the menu that controls boolean display flags.
      Returns:
      the menu that controls boolean display flags.
    • isDisplayTrack

      public boolean isDisplayTrack()