public class PlotPanel
extends javax.swing.JPanel
Modifier and Type | Class and Description |
---|---|
class |
PlotPanel.DragListener
This class decides how to draw the zoom boxes and where to pan the graph.
|
class |
PlotPanel.ZoomListener
inner classes
|
Modifier and Type | Field and Description |
---|---|
static int |
GUIDE_BOX_SIDE
Constant
|
static java.awt.Image |
toDisplay
The image of the plot
|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
PlotPanel(GraphPanel owner,
PlotState s)
Constructor that creates a plotpanel from a plotstate
|
Modifier and Type | Method and Description |
---|---|
void |
addPointClickedListener(PointClickedListener pcl)
Add pointClickedListeners to be notified when a user clicks on the
screen.
|
void |
autoScaleAxis(int axis)
Auto-scales the specified axis.
|
void |
clear()
Removes all solution specific information from the plot and resets to
initial ranges.
|
void |
equilibriumReceived()
Readjust the scale and repain when a new Equilibrium is received.
|
void |
export(java.io.FileOutputStream out)
Exports the graph to PostScript.
|
void |
fillPlot()
Repaints and autoscales if autoscale is on.
|
boolean |
getAutoScale()
Returns whether the autoscale is on.
|
SinglePlotState.DirFieldSettings |
getDfSettings()
Returns the direction field's settings.
|
boolean |
getDirFieldOn()
Returns whether the graph's dirfield is on or off.
|
boolean |
getEquMode()
Returns whether graph is in equilibrium finder mode.
|
boolean |
getICMode()
Returns whether graph is in initial conditions mode.
|
boolean |
getPanMode()
Returns whether graph is in pan mode.
|
boolean |
getPlotOrbitMode()
Returns whether graph is in plot orbit mode.
|
PlotState |
getPlotState()
Returns the plotstate.
|
java.lang.String |
getTitle()
Returns the plot's title.
|
java.lang.String |
getXLabel()
Returns the plot's x-axis label.
|
double[] |
getXRange()
Returns the range of the x-axis.
|
ODEVar |
getXVar()
Returns the variable plotted on the x-axis.
|
java.lang.String |
getYLabel()
Returns the plot's y-axis label.
|
double[] |
getYRange()
Returns the range of the y-axis.
|
ODEVarVector |
getYVars() |
boolean |
getZoomMode()
Returns whether graph is in zoom mode.
|
boolean |
isDirFieldPossible()
returns whether or not the variables on this plot have a dir-field.
|
void |
notifyPointClickedListeners(java.awt.geom.Point2D.Double point)
Notifies all the PointClickedListeners of a user clicking a point on the
screen
|
void |
paint(java.awt.Graphics graphics)
Paint the component contents.
|
void |
printPlot()
Prints the plot (on a printer)
|
void |
scalePlotToFit()
Forcibly autoscales the graph.
|
void |
setAutoscale(boolean scale)
Sets auto-scaling on or off.
|
void |
setAutoscaleNeeded()
Tells the state that, if autoscale is on, the graph needs to be
autoscaled.
|
void |
setDirColor(java.awt.Color color)
Changes the color of dirfield arrows.
|
void |
setDirFieldOn(boolean dirFieldOn)
Turns dirFields on or off.
|
void |
setDirFieldSettings(SinglePlotState.DirFieldSettings settings)
Sets all dir field settings at once.
|
void |
setDirScale(double d)
I believe this changes the length of dirfield arrows but am not sure
|
void |
setDirXCount(int value)
Changes the number of arrows on the x-direction of the direction field.
|
void |
setDirYCount(int value)
Changes the number of arrows on the y-direction of the direction field.
|
void |
setEquMode()
Sets "find equilibrium" mode on.
|
void |
setGrid(boolean on)
Toggles gridlines on or off.
|
void |
setICMode()
Sets pick initial conditions mode on.
|
void |
setLogscaleX(boolean log)
sets x-axis log-scale on or off.
|
void |
setLogscaleY(boolean log)
sets y-axis log-scale on or off.
|
void |
setPanMode()
Set the panning mode on.
|
void |
setPlotOrbitMode()
Set the plot orbit mode on.
|
void |
setPopupMode(boolean b)
This function essentially forces the graph to do nothing the next time
repaint is called, after which repaint behaves normally.
|
void |
setRange(double xMin,
double xMax,
double yMin,
double yMax)
Sets the ranges of the axes.
|
void |
setSlopeType(SinglePlotState.DirLineType type)
Changes how the dirfield is displayed.
|
void |
setTitle(java.lang.String s)
Changes the graph's title and repaints it.
|
void |
setXLabel(java.lang.String s)
Changes the graph's x-axis label and repaints it.
|
void |
setYLabel(java.lang.String s)
Changes the graph's y-axis label and repaints it.
|
void |
setZoomMode()
Set the zooming mode on or off.
|
void |
setZoomSquare()
Zooms the plot out so that shapes are preserved.
|
void |
solutionReceived()
Tells state it needs a new autoscale, and redraws the graph.
|
void |
updateAutoScale(boolean aS)
Sets the autoscale and, if the autoscale is changed to on, forcibly
autoscales the graph.
|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
public static java.awt.Image toDisplay
public static final int GUIDE_BOX_SIDE
public PlotPanel(GraphPanel owner, PlotState s)
owner
- the GraphPanel that owns this plotpanels
- the state of the plotpublic void paint(java.awt.Graphics graphics)
paint
in class javax.swing.JComponent
graphics
- The graphics context.public void clear()
public void fillPlot()
public void printPlot()
public void addPointClickedListener(PointClickedListener pcl)
pcl
- The PointClickedListener to notify.public void notifyPointClickedListeners(java.awt.geom.Point2D.Double point)
point
- A 2 element array of doubles containing the coordinates of the
point clicked.public void setTitle(java.lang.String s)
s
- public void setXLabel(java.lang.String s)
s
- public void setYLabel(java.lang.String s)
s
- public void setEquMode()
public void setPanMode()
public void setPlotOrbitMode()
public void setICMode()
public void setZoomMode()
public boolean getPlotOrbitMode()
public boolean getEquMode()
public boolean getICMode()
public boolean getZoomMode()
public boolean getPanMode()
public void setPopupMode(boolean b)
public java.lang.String getTitle()
public java.lang.String getXLabel()
public java.lang.String getYLabel()
public void setGrid(boolean on)
on
- true iff turn the gridlines on, false otherwisepublic double[] getXRange()
public double[] getYRange()
public void setLogscaleX(boolean log)
log
- true iff set to on, false otherwisepublic void setLogscaleY(boolean log)
log
- true iff set to on, false otherwisepublic void solutionReceived()
public void equilibriumReceived()
public PlotState getPlotState()
public boolean getAutoScale()
public void setAutoscale(boolean scale)
scale
- true iff set to on, false otherwisepublic void setAutoscaleNeeded()
public void autoScaleAxis(int axis)
axis
- int representing the axis (0 for x, 1 for y)public ODEVar getXVar()
public ODEVarVector getYVars()
public void export(java.io.FileOutputStream out)
out
- the output streampublic void scalePlotToFit()
public void updateAutoScale(boolean aS)
aS
- true iff set to true, false otherwisepublic void setZoomSquare()
public void setRange(double xMin, double xMax, double yMin, double yMax)
xMin
- the minimum value on x-axisxMax
- the maximum value on x-axisyMin
- the minimum value on y-axisyMax
- the maximum value on y-axispublic boolean isDirFieldPossible()
public void setDirFieldOn(boolean dirFieldOn)
dirFieldOn
- true iff turn on, false otherwisepublic boolean getDirFieldOn()
public void setDirColor(java.awt.Color color)
color
- the new color of the direction field arrowspublic void setDirScale(double d)
d
- the new length of the dirfield arrowspublic void setSlopeType(SinglePlotState.DirLineType type)
type
- the new line type of the dirfield arrowspublic void setDirXCount(int value)
value
- the number of arrows on the x-directionpublic void setDirYCount(int value)
value
- the number of arrows on the y-directionpublic void setDirFieldSettings(SinglePlotState.DirFieldSettings settings)
settings
- the new settings of the direction fieldpublic SinglePlotState.DirFieldSettings getDfSettings()