jcontrol.ui.vole.graph
Class Diagram

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

(c) Copyright 2003-2007 DOMOLOGIC GmbH

See Also:
Histogram

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
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 setCaption(String captionMin, String captionMax, int captionAlign)
          Sets a caption text that is displayed for the min and max value at the left of the diagram.
 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, 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

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

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

setCaption

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

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

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.