Class InteractivePanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, InteractiveMouseHandler, OSPRuntime.Disposable, Renderable
Direct Known Subclasses:
PlottingPanel, VideoPanel

public class InteractivePanel extends DrawingPanel implements InteractiveMouseHandler
InteractivePanel is a drawing panel that invokes the handleMouseAction method in Interactive objects.
Version:
1.0
Author:
Wolfgang Christian, Francisco Esquembre
See Also:
  • Field Details

  • Constructor Details

    • InteractivePanel

      public InteractivePanel(InteractiveMouseHandler in)
      Constructs an InteractivePanel with the given handler.
      Parameters:
      in - InteractiveMouseHandler
    • InteractivePanel

      public InteractivePanel()
      Constructs an InteractivePanel with an internal handler.
  • Method Details

    • setMouseListeners

      protected void setMouseListeners()
      Overrides:
      setMouseListeners in class DrawingPanel
    • addDrawable

      public void addDrawable(Drawable drawable)
      Adds a drawable object to the drawable list.
      Overrides:
      addDrawable in class DrawingPanel
      Parameters:
      drawable -
    • clear

      public void clear()
      Removes all drawable objects from the drawable list.
      Overrides:
      clear in class DrawingPanel
    • scaleX

      protected void scaleX(ArrayList<Drawable> tempList)
      Sets the x axis scale based on the max and min values of all measurable objects. Autoscale flag is not respected.
      Overrides:
      scaleX in class DrawingPanel
    • scaleY

      protected void scaleY(ArrayList<Drawable> tempList)
      Sets the y axis scale based on the max and min values of all measurable objects. Autoscale flag is not respected.
      Overrides:
      scaleY in class DrawingPanel
    • setInteractiveMouseHandler

      public void setInteractiveMouseHandler(InteractiveMouseHandler handler)
      Sets the interactive mouse handler. The interactive mouse handler is notified whenever a mouse action occurs.
      Parameters:
      handler - the mouse handler
    • handleMouseAction

      public void handleMouseAction(InteractivePanel panel, MouseEvent evt)
      Handles mouse actions by dragging the current interactive drawable object.
      Specified by:
      handleMouseAction in interface InteractiveMouseHandler
      Parameters:
      panel -
      evt -
    • getCurrentDraggable

      public Interactive getCurrentDraggable()
      Get the Interactive object that is currently being dragged.
      Returns:
      Interactive
    • getInteractive

      public Interactive getInteractive()
      Gets the interactive object that was accessed by the last mouse event.
      Returns:
      Interactive
    • setShowCoordinates

      public void setShowCoordinates(boolean show)
      Shows the coordinates in the text box in the lower left hand corner.
      Overrides:
      setShowCoordinates in class DrawingPanel
      Parameters:
      show -
    • getMouseButton

      public int getMouseButton()
      Gets the mouse button of the last mouse event.
      Returns:
      int
    • getMouseClickCount

      public int getMouseClickCount()
      Gets the click count of the last mouse event.
      Returns:
      int
    • getMouseAction

      public int getMouseAction()
      Gets the last mouse action.
      Returns:
      int
    • getMouseIntX

      public int getMouseIntX()
      Gets the x pixel coordinate of the last mouse event.
      Returns:
      pixel
    • getMouseIntY

      public int getMouseIntY()
      Gets the y pixel coordinate of the last mouse event.
      Returns:
      pixel
    • getMouseX

      public double getMouseX()
      Gets the x world coordinate of the last mouse event.
      Returns:
      coordiante
    • getMouseY

      public double getMouseY()
      Gets the y world coordinate of the last moust event
      Returns:
      coordinate
    • saveMouseEvent

      public void saveMouseEvent(int type, MouseEvent evt)
      Saves the last mouse event.
      Parameters:
      type -
      evt -
    • dispose

      public void dispose()
      Specified by:
      dispose in interface OSPRuntime.Disposable
      Overrides:
      dispose in class DrawingPanel