Class BarMeter

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class BarMeter extends JPanel
BarMeter presents a vertical, block-style meter to present numerical information as a fraction of a number of divisions (eg, progress or resource consumption). The default number of divisions is variable, but the default is 1. The meter represents inputted values as one of either color, one "Used" and the other "Un-Used." Used are filled in to the the percentage value inputted (integer) divided by the number of divisions. The default color used is Green, and default unused is Dark Grey.

$Logfile: /mipav/src/gov/nih/mipav/view/BarMeter.java $ $Revision: 10 $ $Date: 7/02/04 1:30p $

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • boxHeight

      int boxHeight
      DOCUMENT ME!
    • boxWidth

      int boxWidth
      DOCUMENT ME!
    • g2d

      DOCUMENT ME!
    • h

      int h
      DOCUMENT ME!
    • img

      DOCUMENT ME!
    • unusedColor

      Color unusedColor
      DOCUMENT ME!
    • unusedRect

      Rectangle2D unusedRect
      DOCUMENT ME!
    • usedColor

      Color usedColor
      DOCUMENT ME!
    • usedRect

      Rectangle2D usedRect
      DOCUMENT ME!
    • w

      int w
      DOCUMENT ME!
    • whitespaceH

      int whitespaceH
      DOCUMENT ME!
    • whitespaceW

      int whitespaceW
      DOCUMENT ME!
    • amplitude

      private int amplitude
      DOCUMENT ME!
    • divisions

      private int divisions
      DOCUMENT ME!
  • Constructor Details

    • BarMeter

      public BarMeter()
      Constructs a barmeter with a background color of black. Does not show the meter.
  • Method Details

    • getMaximumSize

      public Dimension getMaximumSize()
      Maximum size of this panel.
      Overrides:
      getMaximumSize in class JComponent
      Returns:
      DOCUMENT ME!
    • getMinimumSize

      public Dimension getMinimumSize()
      Minimum size of this panel.
      Overrides:
      getMinimumSize in class JComponent
      Returns:
      DOCUMENT ME!
    • getPreferredSize

      public Dimension getPreferredSize()
      Preferred size of this panel.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      DOCUMENT ME!
    • paintComponent

      public void paintComponent(Graphics g)
      Draws the vertical bar, or all 100invalid input: '&#37' of posible amplitude values.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - DOCUMENT ME!
    • setAmplitude

      public void setAmplitude(int amp)
      sets the height of the of the bar reading.
      Parameters:
      amp - percentage amount of the amplitude. ARguments greater than 100 (invalid input: '&#37') or less than zero are thrown out.
    • setDivisions

      public void setDivisions(int div)
      applies the given int to the total number of bars on the display.
      Parameters:
      div - sets the number of bars, or divisions, on the display. the finest resolution that may be displayed, is then 100/div (invalid input: '&#37').
    • setUnusedColor

      public void setUnusedColor(Color c)
      applies the given color to bars which are not lit and are above the set amplitude.
      Parameters:
      c - color used in divisions that represent values smaller than the amplitude.
    • setUsedColor

      public void setUsedColor(Color c)
      applies the given color to bars which are "lit" and are up to the set amplitude.
      Parameters:
      c - color used in divisions that represent values smaller than the amplitude.