Class SimpleChartPopupMenu

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

public class SimpleChartPopupMenu extends JPopupMenu implements MouseListener
Popup menu that can be attached to a Chart to provide common actions for the user. Supported chart types must have a ChartPopupAdaptor and an associated constructor in this class. If you want the menu to appear with a popup event, then you must add it as a mouse listener of the target view. Alternatively you can use one of the static convenience methods: addPopupMenuTo() to both create the popup menu and add it as a mouse listener to the chart.
Author:
tap
See Also:
  • Field Details

  • Constructor Details

    • SimpleChartPopupMenu

      public SimpleChartPopupMenu(Component aChart, ChartPopupAdaptor anAdaptor)
      Primary constructor
    • SimpleChartPopupMenu

      public SimpleChartPopupMenu(FunctionGraphsJPanel aChart)
      Create a simple chart popup menu for a FunctionGraphsJPanel chart
  • Method Details

    • addPopupMenuTo

      public static SimpleChartPopupMenu addPopupMenuTo(Component aChart, ChartPopupAdaptor anAdaptor)
      Convenience method for creating a SimpleChartPopupMenu and adding it as a menu listener to the chart.
      Parameters:
      aChart - The chart to manage
      anAdaptor - The chart popup adaptor to use
      Returns:
      The popup menu instance
    • addPopupMenuTo

      public static SimpleChartPopupMenu addPopupMenuTo(FunctionGraphsJPanel aChart)
      Convenience method for creating a SimpleChartPopupMenu and adding it as a menu listener to the chart.
      Parameters:
      aChart - The chart to manage
      Returns:
      The popup menu instance
    • setup

      protected void setup()
      Initialize the popup menu.
    • initComponents

      protected void initComponents()
      Create and initialize the GUI components
    • defineActions

      protected void defineActions()
      Define the actions for the popup menu
    • storeActions

      protected void storeActions()
      Put the actions in the table.
    • buildMenu

      protected void buildMenu()
      Build the popup menu by adding all of the defined actions
    • update

      protected void update()
      Update the components to reflect the state of the chart
    • setActionEnabled

      public void setActionEnabled(String actionID, boolean enableState)
      Enable/Disable the action specified by the actionID.
      Parameters:
      actionID - The id of the action to enable/disable.
      enableState - The desired enable/disable state.
    • mouseClicked

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

      public void mouseEntered(MouseEvent event)
      implement MouseListener interface
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent event)
      implement MouseListener interface
      Specified by:
      mouseExited in interface MouseListener
    • mousePressed

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

      public void mouseReleased(MouseEvent event)
      implement MouseListener interface
      Specified by:
      mouseReleased in interface MouseListener
    • handleMouseEvent

      public void handleMouseEvent(MouseEvent event)
      handle the mouse event