public class GenericGraphApplet extends Applet implements ActionListener, ItemListener
Applet.AccessibleApplet
Panel.AccessibleAWTPanel
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected DisplayCanvas |
canvas
The canvas for displaying axes, graphs, etc.
|
protected Button |
computeButton
A button that the user presses to recompute the display.
|
protected int[] |
defaultFrameSize
The default size for the frame when the applet runs a launch button.
|
protected JCMPanel |
exampleMenuPanel
A panel containing examples specified in applet parameters, if any.
|
protected String |
frameTitle
The string that is used as the title of the frame, if the applet appears as
a launch button.
|
protected ExpressionInput |
functionInput
An input box for inputting an expression.
|
protected JCMPanel |
inputPanel
A panel containing the functionInput.
|
protected LimitControlPanel |
limitsPanel
Controls the limits of the x- and y-coordinates on the canvas.
|
protected Controller |
mainController
The Controller from the mainPanel.
|
protected JCMPanel |
mainPanel
The main panel of the applet, containing a display canvas and other components.
|
protected Hashtable |
parameterDefaults
A hash table that, if non-null, can hold values for applet params.
|
protected Parser |
parser
The parser which is used for parsing input from the functionInput box.
|
protected Variable |
xVar
The variable that is created and added to the parser.
|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
GenericGraphApplet() |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent evt)
Respond when user clicks a button; not meant to be called directly.
|
protected void |
addCanvasBorder()
This method is called by setUpMainPanel() to add a border to the canvas (since the border is typically
the last thing that should be added, on top of anything else in the canvas.
|
void |
destroy()
Closes the frame (if any) when the applet is destroyed.
|
protected void |
doLoadExample(String example)
This method is called when the user loads an example from the example menu (if any).
|
protected Color |
getColorParam(String data)
Get The value of an applet parameter that specifies a color.
|
protected Color |
getColorParam(String paramName,
Color defaultColor)
Get The value of an applet parameter that specifies a color.
|
protected double[] |
getNumericParam(String paramName)
Get The value of an applet parameter that consists of a list of numbers.
|
protected double[] |
getNumericParam(String paramName,
double[] defaults)
Get The value of an applet parameter that consists of a list of numbers.
|
String |
getParameter(String paramName)
Override the standard applet method getParameter(String) so that when no param value
is provided in the applet tag, and if parameterDefaults is non-null, it will check for a value
the parameterDefaults.
|
protected String |
getParameter(String paramName,
String defaultValue)
Get the value of an applet parameter, but return a default if the value is null.
|
void |
init()
The init() method is called by the system to set up the applet.
|
void |
itemStateChanged(ItemEvent evt)
Respond when user chooses an example from the example menu.
|
protected Axes |
makeAxes()
Construct a set of Axes, based on applet params "AxesColor", "AxesLightColor",
"XLabel", "YLabel", "LabelColor".
|
protected TableFunction |
parseTableFuncDef(String def)
Create a TableFunction from a string.
|
protected void |
setUpBottomPanel()
This method checks the applet parameter "UseFunctionInput".
|
protected void |
setUpCanvas()
This method is called by mainPanel() to set up the display canvas and add it to the
main panel.
|
protected void |
setUpExampleMenu()
This method processes applet parameters that specify examples for the applet and adds them
to a menu of examples.
|
protected void |
setUpLimitsPanel()
This method sets up the limit control panel and adds it to the main panel.
|
protected void |
setUpMainPanel()
This method is called to set up the main panel of the applet.
|
protected void |
setUpParameterDefaults()
This method, which is empty in the GenericGraphApplet class, can be defined in a subclass
to set default values for applet params that are different from the ones provided in
this class.
|
protected void |
setUpParser()
This method is called by setUpMainPanel() to set up the parser to be used in the applet.
|
protected void |
setUpTopPanel()
This method is called by setUpMainPanel() to add a panel at the top of the applet.
|
void |
stop()
Releases the resources used by the display canvas when the applet is stopped.
|
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus, start
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected Parser parser
protected JCMPanel mainPanel
protected Controller mainController
protected DisplayCanvas canvas
protected LimitControlPanel limitsPanel
protected ExpressionInput functionInput
protected Variable xVar
protected JCMPanel inputPanel
protected JCMPanel exampleMenuPanel
protected Button computeButton
protected String frameTitle
protected int[] defaultFrameSize
protected Hashtable parameterDefaults
public void init()
protected void setUpMainPanel()
protected void setUpCanvas()
protected Axes makeAxes()
protected void addCanvasBorder()
protected void setUpBottomPanel()
protected void setUpLimitsPanel()
protected void setUpTopPanel()
protected void setUpExampleMenu()
protected void setUpParser()
protected void doLoadExample(String example)
protected void setUpParameterDefaults()
public String getParameter(String paramName)
getParameter
in class Applet
protected String getParameter(String paramName, String defaultValue)
paramName
- The name of the applet parameter.defaultValue
- The value to be returned if getParameter(paramName) is null.protected double[] getNumericParam(String paramName)
protected double[] getNumericParam(String paramName, double[] defaults)
paramName
- The name of the applet parameter.defaultValue
- The value to be returned if getParameter(paramName) is null or is not a valid list of numbers.protected Color getColorParam(String data)
protected Color getColorParam(String paramName, Color defaultColor)
paramName
- The name of the applet parameter.defaultColor
- The value to be returned if getParameter(paramName) is null or is not a valid color.public void stop()
public void destroy()
protected TableFunction parseTableFuncDef(String def)
public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
public void itemStateChanged(ItemEvent evt)
itemStateChanged
in interface ItemListener