jcontrol.ui.vole.graph
Class Histogram

java.lang.Object
  extended by jcontrol.ui.vole.Component
      extended by jcontrol.ui.vole.graph.Histogram

public class Histogram
extends Component

This class Histogram.class provides a histogram for JControl.
New values are pushed in from the right side, older values are moved over to the left. Thus, the oldest value shown is the value on the very left.

(c) Copyright 2003-2007 DOMOLOGIC GmbH

See Also:
Diagram

Field Summary
static int ALIGN_LEFT
          Align the caption to the left side of the diagram
static int ALIGN_RIGHT
          Align the caption to the right side of the diagram
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Histogram(int x, int y, int width, int height, int min, int max, int resolution)
          Creates a Histogram.
 
Method Summary
 void paint()
          Repaints the Histogram.
 void setBounds(int x, int y, int width, int height)
          Sets a new position and size for the Histogram.
 void setCaption(String captionMin, String captionMax, int captionAlign)
          Sets a caption text which is displayed for the min and max value at the left of the histogram.
 void setValue(int value)
          Adds a new value to the Histogram.
 boolean transferFocus()
          We never gain the input focus.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, onKeyEvent, remove, removeFocus, requestFocus, setFont, setGraphics, setParent, setVisible, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

ALIGN_LEFT

public static final int ALIGN_LEFT
Align the caption to the left side of the diagram

See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Align the caption to the right side of the diagram

See Also:
Constant Field Values
Constructor Detail

Histogram

public Histogram(int x,
                 int y,
                 int width,
                 int height,
                 int min,
                 int max,
                 int resolution)
Creates a Histogram.

Parameters:
x - the x coordinate.
y - the y coordinate.
width - the width.
height - the height.
min - the minimum value the Histogram will be able to show.
max - the maximum value the Histogram will be able to show.
resolution - the number of blocks that should be shown in the Histogram
Method Detail

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets a new position and size for the Histogram.

Overrides:
setBounds in class Component
Parameters:
x - the new x coordinate
y - the new y coordinate
width - the new width
height - the new height

setCaption

public void setCaption(String captionMin,
                       String captionMax,
                       int captionAlign)
Sets a caption text which is displayed for the min and max value at the left of the histogram.

Parameters:
captionMin - Text to display at the bottom
captionMax - Text to display at the top
captionAlign - ALIGN_LEFT or ALIGN_RIGHT

setValue

public void setValue(int value)
Adds a new value to the Histogram. All existing values are moved over to the left. The oldest value will be lost.

Parameters:
value - the new value to set.

paint

public void paint()
Repaints the Histogram.

Overrides:
paint in class Component

transferFocus

public boolean transferFocus()
We never gain the input focus.

Overrides:
transferFocus in class Component
Returns:
true, if the focus was transferred successfully.