Class DefaultPlotEditor

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
DefaultPolarPlotEditor

class DefaultPlotEditor extends JPanel implements ActionListener
A panel for editing the properties of a Plot.
  • Field Details

    • orientationNames

      private static final String[] orientationNames
      Orientation constants.
    • ORIENTATION_VERTICAL

      private static final int ORIENTATION_VERTICAL
      See Also:
    • ORIENTATION_HORIZONTAL

      private static final int ORIENTATION_HORIZONTAL
      See Also:
    • backgroundPaintSample

      private PaintSample backgroundPaintSample
      The paint (color) used to fill the background of the plot.
    • outlineStrokeSample

      private StrokeSample outlineStrokeSample
      The stroke used to draw the outline of the plot.
    • outlinePaintSample

      private PaintSample outlinePaintSample
      The paint (color) used to draw the outline of the plot.
    • domainAxisPropertyPanel

      private DefaultAxisEditor domainAxisPropertyPanel
      A panel used to display/edit the properties of the domain axis (if any).
    • rangeAxisPropertyPanel

      private DefaultAxisEditor rangeAxisPropertyPanel
      A panel used to display/edit the properties of the range axis (if any).
    • availableStrokeSamples

      private StrokeSample[] availableStrokeSamples
      An array of stroke samples to choose from.
    • plotInsets

      private RectangleInsets plotInsets
      The insets for the plot.
    • plotOrientation

      private PlotOrientation plotOrientation
      The orientation for the plot (for CategoryPlots and XYPlots).
    • orientationCombo

      private JComboBox orientationCombo
      The orientation combo box (for CategoryPlots and XYPlots).
    • drawLines

      private Boolean drawLines
      Whether or not to draw lines between each data point (for LineAndShapeRenderers and StandardXYItemRenderers).
    • drawLinesCheckBox

      private JCheckBox drawLinesCheckBox
      The checkbox for whether or not to draw lines between each data point.
    • drawShapes

      private Boolean drawShapes
      Whether or not to draw shapes at each data point (for LineAndShapeRenderers and StandardXYItemRenderers).
    • drawShapesCheckBox

      private JCheckBox drawShapesCheckBox
      The checkbox for whether or not to draw shapes at each data point.
    • localizationResources

      protected static ResourceBundle localizationResources
      The resourceBundle for the localization.
  • Constructor Details

    • DefaultPlotEditor

      public DefaultPlotEditor(Plot plot)
      Standard constructor - constructs a panel for editing the properties of the specified plot.

      In designing the panel, we need to be aware that subclasses of Plot will need to implement subclasses of PlotPropertyEditPanel - so we need to leave one or two 'slots' where the subclasses can extend the user interface.

      Parameters:
      plot - the plot, which should be changed.
  • Method Details

    • createPlotPanel

      protected JPanel createPlotPanel(Plot plot)
      Creates and returns a panel for editing the settings of the specified plot.
      Parameters:
      plot - the plot.
      Returns:
      A panel.
    • createPlotTabs

      protected JTabbedPane createPlotTabs(Plot plot)
      Creates and returns a tabbed pane containing controls for setting the attributes of the specified plot.
      Parameters:
      plot - the plot.
      Returns:
      A tabbed pane.
    • getPlotInsets

      public RectangleInsets getPlotInsets()
      Returns the current plot insets.
      Returns:
      The current plot insets.
    • getBackgroundPaint

      public Paint getBackgroundPaint()
      Returns the current background paint.
      Returns:
      The current background paint.
    • getOutlineStroke

      public Stroke getOutlineStroke()
      Returns the current outline stroke.
      Returns:
      The current outline stroke (possibly null).
    • getOutlinePaint

      public Paint getOutlinePaint()
      Returns the current outline paint.
      Returns:
      The current outline paint.
    • getDomainAxisPropertyEditPanel

      public DefaultAxisEditor getDomainAxisPropertyEditPanel()
      Returns a reference to the panel for editing the properties of the domain axis.
      Returns:
      A reference to a panel.
    • getRangeAxisPropertyEditPanel

      public DefaultAxisEditor getRangeAxisPropertyEditPanel()
      Returns a reference to the panel for editing the properties of the range axis.
      Returns:
      A reference to a panel.
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Handles user actions generated within the panel.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - the event
    • attemptBackgroundPaintSelection

      private void attemptBackgroundPaintSelection()
      Allow the user to change the background paint.
    • attemptOutlineStrokeSelection

      private void attemptOutlineStrokeSelection()
      Allow the user to change the outline stroke.
    • attemptOutlinePaintSelection

      private void attemptOutlinePaintSelection()
      Allow the user to change the outline paint. We use JColorChooser, so the user can only choose colors (a subset of all possible paints).
    • attemptOrientationSelection

      private void attemptOrientationSelection()
      Allow the user to modify the plot orientation if this is an editor for a CategoryPlot or a XYPlot.
    • attemptDrawLinesSelection

      private void attemptDrawLinesSelection()
      Allow the user to modify whether or not lines are drawn between data points by LineAndShapeRenderers and StandardXYItemRenderers.
    • attemptDrawShapesSelection

      private void attemptDrawShapesSelection()
      Allow the user to modify whether or not shapes are drawn at data points by LineAndShapeRenderers and StandardXYItemRenderers.
    • updatePlotProperties

      public void updatePlotProperties(Plot plot)
      Updates the plot properties to match the properties defined on the panel.
      Parameters:
      plot - The plot.