Class DiagramPanel

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

public class DiagramPanel extends JPanel implements ActionListener, MouseMotionListener
This java class is used to create and show the 2-D diagrams of the input values
Author:
Sina Tabakhi
See Also:
  • Field Details

    • f

    • fileMenu

      JMenu fileMenu
    • mi_save

      JMenuItem mi_save
    • mi_saveAs

      JMenuItem mi_saveAs
    • mi_close

      JMenuItem mi_close
    • txt_info

      JTextField txt_info
    • PATH_PROJECT

      private final String PATH_PROJECT
    • LIST_ITERATION

      private final double[][] LIST_ITERATION
    • LIST_CASES

      private final int[] LIST_CASES
    • axisValues

      private ArrayList<DiagramPanel.TupleValues> axisValues
    • NAME_MAIN_PANEL

      private final String NAME_MAIN_PANEL
    • NAME_DIAGRAM

      private final String NAME_DIAGRAM
    • NAME_Y_AXIS

      private final String NAME_Y_AXIS
    • NAME_LEGEND_LABEL

      private final String NAME_LEGEND_LABEL
    • intervalYDimension

      private int intervalYDimension
    • maxValue

      private int maxValue
    • minValue

      private int minValue
    • tempMaxValue

      private double tempMaxValue
    • tempMinValue

      private double tempMinValue
    • X_DIMENSION_START

      private final int X_DIMENSION_START
      See Also:
    • X_DIMENSION_END

      private final int X_DIMENSION_END
      See Also:
    • Y_DIMENSION_START

      private final int Y_DIMENSION_START
      See Also:
    • Y_DIMENSION_END

      private final int Y_DIMENSION_END
      See Also:
    • WIDTH_LEGEND

      private final int WIDTH_LEGEND
      See Also:
    • X_D_START_LEGEND

      private final int X_D_START_LEGEND
      See Also:
    • Y_D_START_LEGEND

      private final int Y_D_START_LEGEND
      See Also:
    • COLOR_SET

      private final Color[] COLOR_SET
  • Constructor Details

    • DiagramPanel

      public DiagramPanel(double[][] arrayIteration, int[] arrayCases, String namePanel, String name, String nameY, String nameLegend, String path)
      Creates new form DiagramPanel. This method is called from within the constructor to initialize the form.
      Parameters:
      arrayIteration - the results of all iteration
      arrayCases - the all different cases
      namePanel - the name of main panel
      name - the name of diagram
      nameY - the name of Y-axis
      nameLegend - the name of legend
      path - the path of the workspace
  • Method Details

    • findMaxValue

      private void findMaxValue()
      Finds the maximum value of the input array
    • findMinValue

      private void findMinValue()
      Finds the minimum value of the input array
    • paintComponent

      public void paintComponent(Graphics g)
      This method is used to show the diagram.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - the Graphics context in which to paint
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      The listener method for receiving action events. Invoked when an action occurs.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - an action event
    • mi_saveActionPerformed

      private void mi_saveActionPerformed(ActionEvent e)
      This method sets an action for the mi_save button.
      Parameters:
      e - an action event
    • mi_saveAsActionPerformed

      private void mi_saveAsActionPerformed(ActionEvent e)
      This method sets an action for the mi_saveAs button.
      Parameters:
      e - an action event
    • mi_closeActionPerformed

      private void mi_closeActionPerformed(ActionEvent e)
      This method sets an action for the mi_close button.
      Parameters:
      e - an action event
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      The listener method for receiving mouse motion events on a component. Invoked when a mouse button is pressed on a component and then dragged.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      e - an action event
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      The listener method for receiving mouse motion events on a component. Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      e - an action event