org.concord.util
Class LineGraph

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.concord.util.LineGraph
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, ValueGraph

public class LineGraph
extends javax.swing.JComponent
implements ValueGraph

Plot a function of time.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.Color backColor
           
protected  java.awt.Image bi
           
protected  java.awt.Graphics big
           
protected  int cellSize
           
protected  java.util.Vector colorList
           
protected  boolean drawBoundsValues
           
protected  java.text.DecimalFormat format
           
protected  java.util.Vector functions
           
protected  java.awt.Color gridColor
           
protected  int height
           
protected  boolean showingNegative
           
protected  java.awt.event.ComponentAdapter sizeChanged
           
protected  javax.swing.JSlider slider
           
protected  javax.swing.event.ChangeListener sliderChanged
           
protected  java.awt.Font smallFont
           
protected  java.awt.Color textColor
           
protected  int width
           
protected  double yMax
           
protected  double yOrigin
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.concord.util.ValueGraph
colors
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LineGraph()
           
 
Method Summary
 int getCellSize()
           
 java.awt.Color getColor(int index)
          Returns color associated with a particular index.
 double getMax()
           
 javax.swing.JSlider getSlider()
           
 boolean isShowingNegative()
           
protected  double log10(double x)
           
static void main(java.lang.String[] args)
           
 void paintComponent(java.awt.Graphics g)
           
 void reset()
           
 void setBackColor(java.awt.Color color)
           
 void setBoundsValuesVisible(boolean visible)
           
 void setCellSize(int cell)
           
 void setColor(java.awt.Color color, int index)
          Sets the color associated with a particular index.
 void setGridColor(java.awt.Color color)
           
protected  void setLineGraphSize(java.awt.Dimension size)
           
 void setMax(double yMax)
           
 void setMax(float yMax)
           
 void setScaleMax(int scale)
           
 void setShowingNegative(boolean negative)
           
 void setSlider(javax.swing.JSlider slider)
           
 void setSliderValue()
           
 void setTextColor(java.awt.Color color)
           
 void setYOrigin(double yOrigin)
           
 void setYOrigin(float yOrigin)
           
 void sleep(int time)
           
 void update(java.awt.Graphics g)
           
 void updateValue(double x)
           
 void updateValue(double x, int index)
          Updates graph element at index with new value.
 void updateValue(float x)
           
 void updateValue(float x, int index)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

smallFont

protected java.awt.Font smallFont

bi

protected java.awt.Image bi

big

protected java.awt.Graphics big

width

protected int width

height

protected int height

functions

protected java.util.Vector functions

colorList

protected java.util.Vector colorList

yOrigin

protected double yOrigin

yMax

protected double yMax

showingNegative

protected boolean showingNegative

cellSize

protected int cellSize

backColor

protected java.awt.Color backColor

gridColor

protected java.awt.Color gridColor

textColor

protected java.awt.Color textColor

drawBoundsValues

protected boolean drawBoundsValues

format

protected java.text.DecimalFormat format

sliderChanged

protected javax.swing.event.ChangeListener sliderChanged

slider

protected javax.swing.JSlider slider

sizeChanged

protected java.awt.event.ComponentAdapter sizeChanged
Constructor Detail

LineGraph

public LineGraph()
Method Detail

setBackColor

public void setBackColor(java.awt.Color color)

setGridColor

public void setGridColor(java.awt.Color color)

setTextColor

public void setTextColor(java.awt.Color color)

isShowingNegative

public boolean isShowingNegative()

setShowingNegative

public void setShowingNegative(boolean negative)

getCellSize

public int getCellSize()

setCellSize

public void setCellSize(int cell)

setColor

public void setColor(java.awt.Color color,
                     int index)
Sets the color associated with a particular index.

Specified by:
setColor in interface ValueGraph
Parameters:
color - - Color of graph element.
index - - int index of graph element.

getColor

public java.awt.Color getColor(int index)
Returns color associated with a particular index.

Specified by:
getColor in interface ValueGraph
Parameters:
index - - int index of graph element.
Returns:
- Color color of graph element.

getSlider

public javax.swing.JSlider getSlider()

setSlider

public void setSlider(javax.swing.JSlider slider)

setYOrigin

public void setYOrigin(double yOrigin)

setYOrigin

public void setYOrigin(float yOrigin)

getMax

public double getMax()

setMax

public void setMax(double yMax)

setScaleMax

public void setScaleMax(int scale)

log10

protected double log10(double x)

setSliderValue

public void setSliderValue()

setMax

public void setMax(float yMax)

setBoundsValuesVisible

public void setBoundsValuesVisible(boolean visible)

reset

public void reset()

setLineGraphSize

protected void setLineGraphSize(java.awt.Dimension size)

updateValue

public void updateValue(double x,
                        int index)
Updates graph element at index with new value. Uses index mapping to determine the graph element.
Specified by:
updateValue in interface ValueGraph
Parameters:
x - - double value to update.
index - - int index of graph element.

updateValue

public void updateValue(double x)
Specified by:
updateValue in interface ValueGraph

updateValue

public void updateValue(float x,
                        int index)
Specified by:
updateValue in interface ValueGraph

updateValue

public void updateValue(float x)
Specified by:
updateValue in interface ValueGraph

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JComponent

sleep

public void sleep(int time)

main

public static void main(java.lang.String[] args)