jcontrol.ui.vole.graph
Class Histogram

java.lang.Object
  |
  +--jcontrol.ui.vole.Component
        |
        +--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.

Version:
1.1
Author:
Marcus Timmermann, Wolfgang Klingauf
See Also:
Diagram

Field Summary
static int LEFT
           
static int RIGHT
           
 
Fields inherited from class jcontrol.ui.vole.Component
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)
          Creates a Histogram.
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 setGraphics(jcontrol.io.Graphics g)
          This method is called to set the main Display context for this component.
 void setInscription(java.lang.String min, java.lang.String max, int position)
          Sets an inscription text which is displayed for the min and max value at the left of the histogram.
 void setLabel(java.lang.String text)
          Sets a description text which is displayed at the bottom of the histogram.
 void setValue(int value)
          Adds a new value to the Histogram.
 void setValue(int value, boolean update)
           
 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, setLocation, setParent, setVisible, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, notifyAll, wait
 

Field Detail

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

Histogram

public Histogram(int x,
                 int y,
                 int width,
                 int height,
                 int min,
                 int max)
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.

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

paint

public void paint()
Repaints the Histogram.

Overrides:
paint in class Component

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

setGraphics

public void setGraphics(jcontrol.io.Graphics g)
This method is called to set the main Display context for this component. Normally, this is done only for the top-level container, then, all child components are set automatically.

Overrides:
setGraphics in class Component
Parameters:
g - the Display

setInscription

public void setInscription(java.lang.String min,
                           java.lang.String max,
                           int position)
Sets an inscription text which is displayed for the min and max value at the left of the histogram.

Parameters:
min - Text to display at the left bottom
max - Text to display at the left top
position - LEFT or RIGHT

setLabel

public void setLabel(java.lang.String text)
Sets a description text which is displayed at the bottom of the histogram.

Parameters:
text - Text to display

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.

setValue

public void setValue(int value,
                     boolean update)

transferFocus

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

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