|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component net.sourceforge.webcompmath.draw.Drawable net.sourceforge.webcompmath.functions.TableFunctionGraph
public class TableFunctionGraph
A TableFunctionGraph is a Drawable object that can be added to a CoordinateRect (or DisplayCanvas). It draws the graph of a specified TableFunction. A TableFunction is a function and can also be graphed by an object of the class edu.hws.jcm.draw.Graph1D. However, a TableFunctionGraph offers the option of showing the points from the table that defines the function as small disks (true by default) and the option of making the graph "interactive" so that the user can drag the points (false by default).
Nested Class Summary |
---|
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 | |
---|---|
static int |
DASHED_STYLE
Specifies that the shape should be drawn with dashed line(s). |
protected int |
lineStyle
The line style, SOLID_STYLE or DASHED_STYLE |
protected int |
lineWidth
The width, in pixels, of lines. |
static int |
SOLID_STYLE
Specifies that the shape should be drawn with solid line(s). |
Fields inherited from class net.sourceforge.webcompmath.draw.Drawable |
---|
canvas, coords |
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 | |
---|---|
TableFunctionGraph()
Create a TableFunctionGraph that initially draws no function. |
|
TableFunctionGraph(TableFunction function)
Create a TableFunctionGraph to draw the specified TableFunction. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g,
boolean coordsChanged)
Override the draw() method from class Drawable to draw the function. |
java.awt.Color |
getColor()
Get the non-null color that is used for drawing the graph. |
TableFunction |
getFunction()
Get the TableFunction whose graph is drawn by this TableFunctionGraph. |
boolean |
getInteractive()
Get the value of the interactive property, which is true if the user can modify the function by dragging the points from the table. |
int |
getLineStyle()
Get the line style, SOLID_STYLE or DASHED_STYLE |
int |
getLineWidth()
Get the width, in pixels, of lines that are drawn. |
Computable |
getOnDrag()
Get the Computable that is notified as the user drags a point. |
Computable |
getOnFinishDrag()
Get the Computable that is notified when the user finishes dragging a point. |
boolean |
getShowPoints()
Get the showPoints property, which determines whether the points from the table that defines the function are visible as little disks. |
void |
mouseClicked(java.awt.event.MouseEvent evt)
Empty method, required by the MouseListener interface. |
void |
mouseDragged(java.awt.event.MouseEvent evt)
Method required by the MouseListener interface. |
void |
mouseEntered(java.awt.event.MouseEvent evt)
Empty method, required by the MouseMotionListener interface. |
void |
mouseExited(java.awt.event.MouseEvent evt)
Empty method, required by the MouseMotionListener interface. |
void |
mouseMoved(java.awt.event.MouseEvent evt)
Empty method, required by the MouseMotionListener interface. |
void |
mousePressed(java.awt.event.MouseEvent evt)
Method required by the MouseListener interface. |
void |
mouseReleased(java.awt.event.MouseEvent evt)
Method required by the MouseListener interface. |
void |
setColor(java.awt.Color c)
Set the color that is used for drawing the graph. |
void |
setFunction(TableFunction function)
Set the function whose graph is drawn by this TableFunctionGraph. |
void |
setFunctionStyle(int style)
Provided as a convenience. |
void |
setInteractive(boolean interactive)
Set the value of the interactive property, which is true if the user can modify the function by dragging the points from the table. |
void |
setLineStyle(int lineStyle)
Set the line style, SOLID_STYLE or DASHED_STYLE |
void |
setLineWidth(int width)
Set the width, in pixels, of lines that are drawn. |
void |
setOnDrag(Computable c)
Specify a controller whose compute() method will be called repeatedly as the user drags one of the points from the table function. |
void |
setOnFinishDrag(Computable c)
Specify a controller whose compute() method will be called once when the user finishes dragging one of the points from the table function. |
protected void |
setOwnerData(DisplayCanvas canvas,
CoordinateRect coords)
Sets the values of member variables canvas and coords. |
void |
setShowPoints(boolean show)
Set the showPoints property, which determines whether the points from the table that defines the function are visible as little disks. |
Methods inherited from class net.sourceforge.webcompmath.draw.Drawable |
---|
getVisible, needsRedraw, setVisible |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int lineWidth
public static final int SOLID_STYLE
public static final int DASHED_STYLE
protected int lineStyle
Constructor Detail |
---|
public TableFunctionGraph()
public TableFunctionGraph(TableFunction function)
function
- table function to graphMethod Detail |
---|
public void setFunction(TableFunction function)
function
- table function to graphpublic TableFunction getFunction()
public void setOnDrag(Computable c)
c
- computable to use (usually a controller)public Computable getOnDrag()
public void setOnFinishDrag(Computable c)
c
- controller to usepublic Computable getOnFinishDrag()
public void setInteractive(boolean interactive)
interactive
- true or falsepublic boolean getInteractive()
public void setShowPoints(boolean show)
show
- true or falsepublic boolean getShowPoints()
public void setColor(java.awt.Color c)
c
- color for drawingpublic java.awt.Color getColor()
public void setLineWidth(int width)
width
- line widthpublic int getLineWidth()
public int getLineStyle()
public void setLineStyle(int lineStyle)
lineStyle
- The lineStyle to set.protected void setOwnerData(DisplayCanvas canvas, CoordinateRect coords)
setOwnerData
in class Drawable
canvas
- the DisplayCanvas to usecoords
- the CoordinateRect to usepublic void setFunctionStyle(int style)
style
- function stylepublic void draw(java.awt.Graphics g, boolean coordsChanged)
draw
in class Drawable
g
- graphics context to usecoordsChanged
- true or falsepublic void mousePressed(java.awt.event.MouseEvent evt)
mousePressed
in interface java.awt.event.MouseListener
evt
- event created when user clicks mousepublic void mouseReleased(java.awt.event.MouseEvent evt)
mouseReleased
in interface java.awt.event.MouseListener
evt
- event created when user releases mouse buttonpublic void mouseDragged(java.awt.event.MouseEvent evt)
mouseDragged
in interface java.awt.event.MouseMotionListener
evt
- event created while mouse being draggedpublic void mouseClicked(java.awt.event.MouseEvent evt)
mouseClicked
in interface java.awt.event.MouseListener
evt
- the eventpublic void mouseEntered(java.awt.event.MouseEvent evt)
mouseEntered
in interface java.awt.event.MouseListener
evt
- the eventpublic void mouseExited(java.awt.event.MouseEvent evt)
mouseExited
in interface java.awt.event.MouseListener
evt
- the eventpublic void mouseMoved(java.awt.event.MouseEvent evt)
mouseMoved
in interface java.awt.event.MouseMotionListener
evt
- the event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |