|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--GrapherGUI.Graph
Creates a panel object which draws the given functions.
Nested Class Summary | |
class |
Graph.MouseTracker
MouseMotionListener object to handle mouse events. |
Field Summary | |
int |
MAXFUNCTIONS
maximum number of functions one plot can display |
int |
X
width in pixels of the graph |
int |
Y
height in pixels of the visible graph |
short |
ZOOM_IN_X
constant passed into zoom |
short |
ZOOM_IN_Y
constant passed into zoom |
short |
ZOOM_OUT_X
constant passed into zoom |
short |
ZOOM_OUT_Y
constant passed into zoom |
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 | |
Graph()
Class constructor. |
|
Graph(GrapherGUI.SliderMatrix sm,
double minx,
double maxx,
double miny,
double maxy)
Class constructor specifying dimensions of graph. |
Method Summary | |
boolean |
addFunc(GrapherGUI.Function f)
Adds a function to the graph. |
java.awt.Point |
cart2screen(double x,
double y)
Converts a point on the cartesian coordinate plane to a pixel coordinate on the drawing canvas. |
void |
changeStateLinkPoints()
Change the state of the boolean handling whether points on the graph are tied together by lines. |
void |
changeStateShowKey()
Show/remove key. |
void |
drawFunctions()
Draws each function. |
void |
drawGrid()
Draws the axes and all appropriate labels. |
void |
drawKey()
Draw the key onto the top left corner of the graph. |
int |
getDensity()
Get the number of points that are used to draw each function. |
double |
getTheta(java.awt.geom.Line2D l)
Gets the angle in polar coordinates of a line. |
double |
maxx()
Get the maximum x value |
double |
maxy()
Get the maximum y value |
double |
minx()
Get the minimum x value |
double |
miny()
Get the minimum y value |
javax.swing.JLabel |
mouseLabel()
Returns a link to the mouse label. |
void |
paint(java.awt.Graphics g)
Redraws the graph according to the current parameter set. |
void |
scale()
Called after a change in scale. |
java.awt.geom.Point2D.Double |
screen2cart(int x,
int y)
Converts a point on the canvas plane to a point on the cartesian coordinate plane. |
void |
setAxesIcons(java.lang.String xfile,
java.lang.String yfile)
Set an icon for the axes of the graph. |
void |
setAxisLabels(java.lang.String x,
java.lang.String y)
Set an string for the axes of the graph. |
boolean |
setDensity(int d)
Set the number of points that are used to draw each function. |
void |
setMaxx(double d)
Set the maximum x value on the graph. |
void |
setMaxy(double d)
Set the maximum y value on the graph. |
void |
setMinx(double d)
Set the minimum x value on the graph. |
void |
setMiny(double d)
Set the minimum y value on the graph. |
void |
setTickIncrementX(double d)
Set the frequency in which tick marks and labels show up on the x-axis.. |
void |
setTickIncrementY(double d)
Set the frequency in which tick marks and labels show up on the y-axis.. |
java.lang.String |
strMouseCoord()
Returns a string representation of the current mouse coordinates on the graph. |
void |
zoom(short how)
Increases/decreases the domain and range of the graph according to the parameter it recieves. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
Field Detail |
public final int X
public final int Y
public final short ZOOM_IN_X
Graph.zoom
,
Constant Field Valuespublic final short ZOOM_IN_Y
Graph.zoom
,
Constant Field Valuespublic final short ZOOM_OUT_X
Graph.zoom
,
Constant Field Valuespublic final short ZOOM_OUT_Y
Graph.zoom
,
Constant Field Valuespublic final int MAXFUNCTIONS
Constructor Detail |
public Graph()
public Graph(GrapherGUI.SliderMatrix sm, double minx, double maxx, double miny, double maxy)
sm
- the list of parametersminx
- minimum x valuemaxx
- maximum x valueminy
- minimum y valuemaxy
- maximum y valueMethod Detail |
public void setTickIncrementX(double d)
d
- value between tick markspublic void setTickIncrementY(double d)
d
- value between tick marks.public void scale()
public int getDensity()
public boolean setDensity(int d)
d
- number of points to use in drawing each function
public boolean addFunc(GrapherGUI.Function f)
f
- function to be added to the plot
Function
public void setAxesIcons(java.lang.String xfile, java.lang.String yfile)
xfile
- filename of the independent icon file (must be JPEG or GIF)yfile
- filename of the dependent icon (must be JPEG or GIF)public void setAxisLabels(java.lang.String x, java.lang.String y)
x
- x-axis labely
- y-axis labelpublic void changeStateLinkPoints()
public void changeStateShowKey()
public void zoom(short how)
how
- either zoom in x/y or out x/yGraph.ZOOM_IN_X
,
Graph.ZOOM_IN_Y
,
Graph.ZOOM_OUT_X
,
Graph.ZOOM_OUT_Y
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- graphics object on which to drawGraphics
,
Function
public void drawGrid()
If the user specified an image to use for a variable name, that will be drawn near its respective axis. Otherwise, the string name of the parameter will be drawn.
public void drawFunctions()
public void drawKey()
public java.awt.Point cart2screen(double x, double y)
x
- x value (cartesian coordinates)y
- y value (cartesian coordinates)
Point
public java.awt.geom.Point2D.Double screen2cart(int x, int y)
x
- pixel x coordinatey
- pixel y coordinate
Point2D
public double getTheta(java.awt.geom.Line2D l)
l
- object representing the line
Line2D
public java.lang.String strMouseCoord()
public javax.swing.JLabel mouseLabel()
public double minx()
public double miny()
public double maxx()
public double maxy()
public void setMinx(double d)
d
- minimum x valuepublic void setMiny(double d)
d
- minimum y valuepublic void setMaxx(double d)
d
- maximum x valuepublic void setMaxy(double d)
d
- maximum y value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |