Class FigurePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public abstract class FigurePanel extends JComponent
Component which allows the user to identify a region by selecting vertices using the mouse. Various figure modes are available.
Since:
14 Sep 2018
Author:
Mark Taylor
See Also:
  • Field Details

  • Constructor Details

    • FigurePanel

      public FigurePanel(PlotPanel<?,?> plotPanel, FigureMode[] figureModes, boolean isDisplayExpr)
      Constructor.
      Parameters:
      plotPanel - plot panel
      figureModes - available modes
      isDisplayExpr - true to display current expression on screen
  • Method Details

    • clear

      public void clear()
      Resets the current figure to an empty one.
    • getBasicFigureAction

      public Action getBasicFigureAction()
      Returns the action for drawing a figure with the default mode. This is also used to signal that drawing a figure is complete.
      Returns:
      action
    • getModeFigureMenu

      public JMenuItem getModeFigureMenu()
      Returns a menu of options with one item for each figure mode.
      Returns:
      mode-specific figure action menu
    • setActive

      public void setActive(boolean active)
      Sets whether this panel is active (visible, accepting mouse gestures, drawing shapes) or inactive (invisible).
      Parameters:
      active - true to select activeness
    • setListening

      public void setListening(boolean isListening)
      Changes whether this component is listening to mouse gestures to modify the shape. This method is called by setActive, but may be called independently of it as well.
      Parameters:
      isListening - whether mouse gestures can affect current shape
    • isActive

      public boolean isActive()
      Indicates whether this component is currently active.
      Returns:
      true iff this component is active (visible and drawing)
    • figureCompleted

      protected abstract void figureCompleted(Figure figure, int zoneIndex)
      Invoked when this component's action is invoked to terminate a figure drawing session. Implementations of this method are expected to clear up by calling setActive(false) when the figure representation is no longer required.
      Parameters:
      figure - completed figure, not null
      zoneIndex - index of the plot zone in which the figure is considered to exist
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent