|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
grapher.Grapher
public class Grapher
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
Grapher()
Default constructor. |
|
Grapher(java.lang.String xLabel,
java.lang.String yLabel)
Constructor that takes text labels for the x and y axis. |
|
| Method Summary | |
|---|---|
void |
enableAxis(boolean axisEnabled)
Enables or disables showing the y-axis and x-axis and scale labels. |
void |
enableAxisLabelsOnIndicators(boolean axisLabels)
Enables or disables showing the axis label string on the indicator lines in addition to just the value. |
void |
enableGrid(boolean gridEnabled)
Enables or disables the unit grid. |
void |
expandScale(float changeScale)
Expands the visible x and y axis by a factor of changeScale |
float |
getMaxX()
Returns the maximum displayed x value on the scale. |
float |
getMaxY()
Returns the maximum displayed y value on the scale. |
float |
getMinX()
Returns the minimum displayed x value on the scale. |
float |
getMinY()
Returns the minimum displayed y value on the scale. |
float |
getXValue()
Returns the value the vertical x-axis indicator is currently on. |
float |
getYValue()
Returns the value the horizontal y-axis indicator is currently on. |
boolean |
isAxisEnabled()
Returns whether showing the axis is enabled. |
boolean |
isAxisLabelsOnIndicatorsEnabled()
Returns whether showing the axis label string on the indicator lines in addition to just the value is enabled. |
boolean |
isGridEnabled()
Returns whether the unit grid is enabled. |
void |
paintComponent(java.awt.Graphics g)
Draws the graph. |
boolean |
setCoords(float[][] xCoords1,
float[][] yCoords1)
If the number of x and y points are the same, sets the coordinates using references and returns true. |
void |
setMaxX(float newMaxX)
Sets the maximum displayed x value. |
void |
setMaxY(float newMaxY)
Sets the maximum displayed y value. |
void |
setMinX(float newMinX)
Sets the minimum displayed x value. |
void |
setMinY(float newMinY)
Sets the minimum displayed y value. |
boolean |
setScale(float minX1,
float maxX1,
float minY1,
float maxY1)
If the scale is valid (minimums are smaller than maximums), sets the minimum and maximum values to display and returns true. |
boolean |
setScale(int line)
Sets the minimum and maximum values to display to the min and max of the coordinates of the given line. |
void |
setXIndicator(float value,
int line)
Sets the value for the vertical indicator line. |
void |
setYIndicator(float value,
int line)
Sets the value for the horizontal indicator line. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Grapher()
public Grapher(java.lang.String xLabel,
java.lang.String yLabel)
xLabel - Label for the x-axis.yLabel - Label for the y-axis.| Method Detail |
|---|
public boolean setCoords(float[][] xCoords1,
float[][] yCoords1)
xCoords1 - A new set of x-coordinates to display on the graph.yCoords1 - A new set of y-coordinates to display on the graph.
public boolean setScale(float minX1,
float maxX1,
float minY1,
float maxY1)
minX1 - Minimum value to display on the x-axis.maxX1 - Maximum value to display on the x-axis.minY1 - Minimum value to display on the y-axis.maxY1 - Maximum value to display on the y-axis.
public boolean setScale(int line)
line - Integer >= 0 indicating a line to use to set the scale.
public void expandScale(float changeScale)
changeScale - Factor to expand by.public void setMinX(float newMinX)
newMinX - The new minimum x value.public void setMaxX(float newMaxX)
newMaxX - The new maximum x value.public void setMinY(float newMinY)
newMinX - The new minimum y value.public void setMaxY(float newMaxY)
newMaxX - The new maximum y value.
public void setXIndicator(float value,
int line)
value - Value for the vertical (x-axis) indicator line.line - The line to use to find the horizontal indicator value.
public void setYIndicator(float value,
int line)
value - Value for the horizontal (y-axis) indicator line.line - The line to use to find the vertical indicator value.public float getXValue()
public float getYValue()
public float getMinX()
public float getMaxX()
public float getMinY()
public float getMaxY()
public void enableGrid(boolean gridEnabled)
gridEnabled - True to enable the grid, false to disable.public boolean isGridEnabled()
public void enableAxis(boolean axisEnabled)
axisEnabled - True to enable the axis, false to disable.public boolean isAxisEnabled()
public void enableAxisLabelsOnIndicators(boolean axisLabels)
axisEnabled - True to enable the axis, false to disable.public boolean isAxisLabelsOnIndicatorsEnabled()
public void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponent
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||