| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--ciips.animation.Histogram
This is one example of the drawing object inheriting
 java.awt.Panel which can be added to the drawing panel
 (DrawingPanel). 
 
 Since DrawingPanel is also an extension of panel,
 this Histogram panel has to be added to the drawing panel
 by using the following statement (otherwise, the layout manager of
 this class might interprete its dimension as null during the panel
 initialization and nothing will show up): 
	Histogram histogram = new Histogram();
	drawingPanel.setLayout(null);
	drawingPanel.add(histogram);
 	...
	histogram.setTitle("title");
	histogram.setXLabel("x-axis label");
	histogram.setYLabel("y-axis label");
	histogram.setYMax(maxY);
	histogram.setXMax(maxX);
 	histogram.setYStep(10);
	histogram.setXStep(5);
	histogram.reshape(x, y, width, height);
 drawingPanel is an instance of the class object
 DrawingPanel, which can be typically obtained from
 the instance of AlgAnimFrame, by calling the
 getDrawingPanel() method of the class.
 e.g. in AlgThread, the instance of AlgAnimFrame
 is passed in as frame. Therefore, 
 The 
 	drawingPanel = frame.getDrawingPanel();
 
reshape method is inherited from a parent class.
 It is called to move the histogram to position (x, y)
 and set the dimension of the histogram to width x height.
DrawingPanel, 
AlgAnimFrame, 
Panel, Serialized Form| Inner classes inherited from class java.awt.Panel | 
java.awt.Panel.AccessibleAWTPanel | 
| Inner classes inherited from class java.awt.Container | 
java.awt.Container.AccessibleAWTContainer | 
| Inner classes inherited from class java.awt.Component | 
java.awt.Component.AccessibleAWTComponent | 
| Fields inherited from class java.awt.Component | 
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | 
| Fields inherited from interface java.awt.image.ImageObserver | 
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH | 
| Constructor Summary | |
Histogram()
A constructor to this class which set the background of the panel to white, font to size 12 PLAIN courier, and initializes the title, x-axis label, y-axis label, etc.  | 
|
| Method Summary | |
 void | 
draw(java.awt.Graphics g)
Same as paint(). | 
 int | 
getX()
Get the left most position of the panel.  | 
 int | 
getY()
Get the top most position of the panel.  | 
 void | 
incValueX(int x)
Increment the Y value of vertical bar specified by the parameter.  | 
 void | 
init()
Initialize the histogram, removing all bars from the graph.  | 
 void | 
paint(java.awt.Graphics g)
Method to draw objects on the histogram panel.  | 
 void | 
setTitle(java.lang.String title)
Set a title for the histogram.  | 
 void | 
setValueXY(int x,
           int y)
Set the Y value for the vertical bar at the specified X position.  | 
 void | 
setXLabel(java.lang.String xLabel)
Set a title for the x-axis.  | 
 void | 
setXMax(int xMax)
Set the maximum value for the x-axis of the histogram.  | 
 void | 
setXMin(int xMin)
Set the minimum value for the x-axis of the histogram.  | 
 void | 
setXStep(int step)
Set the incremental step for the x-axis of the histogram.  | 
 void | 
setYLabel(java.lang.String yLabel)
Set a title for the y-axis of the histogram.  | 
 void | 
setYMax(int yMax)
Set the maximum value for the y-axis of the histogram.  | 
 void | 
setYMin(int yMin)
Set the minimum value for the y-axis of the histogram.  | 
 void | 
setYStep(int step)
Set the incremental step for the y-axis.  | 
 void | 
update(java.awt.Graphics g)
This method is invoked when the repaint() method is called. | 
| Methods inherited from class java.awt.Panel | 
addNotify, getAccessibleContext | 
| Methods inherited from class java.awt.Container | 
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree | 
| Methods inherited from class java.awt.Component | 
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface ciips.animation.DrawingObj | 
move | 
| Constructor Detail | 
public Histogram()
setBackground method inherited. e.g.
 
	Histogram histogram = new Histogram();
	histogram.setBackground(Color.lightGray);
 
 For detail of what color can be set, refer to 
 java.awt.Color.| Method Detail | 
public void init()
public int getX()
getX in interface DrawingObjgetX in class java.awt.Componentpublic int getY()
getY in interface DrawingObjgetY in class java.awt.Componentpublic void setTitle(java.lang.String title)
title - The new title of the histogram.public void setXLabel(java.lang.String xLabel)
xLabel - new title for the x-axis of the histogram.public void setYLabel(java.lang.String yLabel)
yLabel - new title for the y-axis of the histogram.public void setYMax(int yMax)
yMax - The maximum value for the y-axis of the histogram.public void setYStep(int step)
step - The incremental step for the y-axis of the histogram.public void setYMin(int yMin)
yMin - The new minimum value for the y-axis of the histogram.public void setXMax(int xMax)
xMax - The maximum value for the x-axis of the histogram.public void setXStep(int step)
step - The new incremental step for the x-axis of the histogram.setYStep(int)public void setXMin(int xMin)
xMin - The new minimum value for the x-axis of the histogram.
public void setValueXY(int x,
                       int y)
x - The vertical bar at X = x
 y - The value of the vertical bar specified by the first parameter.public void incValueX(int x)
x - Specifies the vertical bar at X = x.public void update(java.awt.Graphics g)
repaint() method is called.
 The update method is override here to eleminate flashing during
 the updating of the histogram panel.
- Overrides:
 update in class java.awt.Container
 
public void draw(java.awt.Graphics g)
paint(). This method just calls the paint() method.
 It must be defined here to implement the DrawingObj interface.draw in interface DrawingObjpaint(java.awt.Graphics)public void paint(java.awt.Graphics g)
paint in class java.awt.Container
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||