jcontrol.ui.vole.graph
Class Diagram

java.lang.Object
  |
  +--jcontrol.ui.vole.Component
        |
        +--jcontrol.ui.vole.graph.Diagram

public class Diagram
extends Component

This class Diagram.class provides a graphical diagram 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:
Histogram

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
Diagram(int x, int y, int width, int height, int min, int max)
          Creates a Diagram.
Diagram(int x, int y, int width, int height, int min, int max, int resolution)
          Creates a Diagram.
 
Method Summary
 void paint()
          Repaints the Diagram.
 void setBounds(int x, int y, int width, int height)
          Sets a new position and size for the Diagram.
 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 Diagram.
 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

Diagram

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

Parameters:
x - the x coordinate.
y - the y coordinate.
width - the width.
height - the height.
min - the minimum value the Diagram will be able to show.
max - the maximum value the Diagram will be able to show.

Diagram

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

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

paint

public void paint()
Repaints the Diagram.

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 Diagram.

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 Diagram. All existing values are moved over to the left. The oldest value will be lost.

Parameters:
value - the new value to set.

transferFocus

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

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