Class DisplayHistogram

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

public class DisplayHistogram extends JComponent implements MouseMotionListener
This class displays a histogram (instance of Histogram) as a component. Only the first histogram band ins considered for plotting. The component has a tooltip which displays the bin index and bin count for the bin under the mouse cursor.
See Also:
  • Constructor Details

    • DisplayHistogram

      public DisplayHistogram(String title)
      The constructor for this class, which will set its fields' values and get some information about the histogram.
      Parameters:
      title - the title of the plot.
  • Method Details

    • setBinWidth

      public void setBinWidth(int newWidth)
      Override the default bin width (for plotting)
    • setHeight

      public void setHeight(int h)
      Override the default height for the plot.
      Parameters:
      h - the new height.
    • setIndexMultiplier

      public void setIndexMultiplier(int i)
      Override the index multiplying factor (for bins with width != 1)
    • setSkipIndexes

      public void setSkipIndexes(int i)
      Override the index skipping factor (determines how many labels will be printed on the index axis).
    • setMaxCount

      public void setMaxCount(int m)
      Set the maximum value (used to scale the histogram y-axis). The default value is defined in the constructor and can be overriden with this method.
    • getMaximumSize

      public Dimension getMaximumSize()
      This method informs the maximum size of this component, which will be the same as the preferred size.
      Overrides:
      getMaximumSize in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      This method informs the minimum size of this component, which will be the same as the preferred size.
      Overrides:
      getMinimumSize in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      This method informs the preferred size of this component, which will be constant.
      Overrides:
      getPreferredSize in class JComponent
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      This method does not do anything, it is here to keep the MouseMotionListener interface happy.
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      This method will be called when the mouse is moved over the component. It will set the tooltip text on the component to show the histogram data.
      Specified by:
      mouseMoved in interface MouseMotionListener
    • setImage

      public void setImage(PlanarImage wrapRenderedImage)