|
||||||||||
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 java.awt.Panel java.applet.Applet javax.swing.JApplet net.sourceforge.webcompmath.applets.GenericGraphApplet
public class GenericGraphApplet
GenericGraphApplet serves as a base class for applets that have a DisplayCanvas in the CENTER of a BorderLayout and that are configurable by a large number of applet parameters. This base class sets up the basic structure of the applet and processes many applet parameters. Most of the work is done in methods that can be overridden in subclasses. If the height of the applet is greater than 100 and if the applet parameter "LaunchButtonName" is not defined, then the main panel of the applet appears in the applet itself. Otherwise, the applet appears as a button. Clicking the button opens the main panel of the applet in a separate, resizable frame.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JApplet |
---|
javax.swing.JApplet.AccessibleJApplet |
Nested classes/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
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 | |
---|---|
protected DisplayCanvas |
canvas
The canvas for displaying axes, graphs, etc. |
protected javax.swing.JButton |
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 WcmPanel |
exampleMenuPanel
A panel containing examples specified in applet parameters, if any. |
protected float |
fontSize
The font size to use for all fonts |
protected java.lang.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 java.awt.Color |
ggBGColor
The background color for the applet |
protected java.awt.Color |
ggFGColor
The foreground color for the applet |
protected WcmPanel |
inputPanel
A panel containing the functionInput. |
protected java.awt.Font |
lbf
The font for the launch button |
protected LimitControlPanel |
limitsPanel
Controls the limits of the x- and y-coordinates on the canvas. |
protected Controller |
mainController
The Controller from the mainPanel. |
protected WcmPanel |
mainPanel
The main panel of the applet, containing a display canvas and other components. |
protected java.util.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 java.awt.Color |
pBGColor
The background color for the panel |
protected boolean |
presentation
Whether to use thicker lines for projecting the graph on a screen. |
protected Variable |
xVar
The variable that is created and added to the parser. |
Fields inherited from class javax.swing.JApplet |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
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 | |
---|---|
GenericGraphApplet()
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.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(java.lang.String example)
This method is called when the user loads an example from the example menu (if any). |
protected void |
doLoadFirstExample()
Load the first example |
protected java.awt.Color |
getColorParam(java.lang.String data)
Get The value of an applet parameter that specifies a color. |
protected java.awt.Color |
getColorParam(java.lang.String paramName,
java.awt.Color defaultColor)
Get The value of an applet parameter that specifies a color. |
protected double[] |
getNumericParam(java.lang.String paramName)
Get The value of an applet parameter that consists of a list of numbers. |
protected double[] |
getNumericParam(java.lang.String paramName,
double[] defaults)
Get The value of an applet parameter that consists of a list of numbers. |
java.lang.String |
getParameter(java.lang.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 in the parameterDefaults. |
protected java.lang.String |
getParameter(java.lang.String paramName,
java.lang.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(java.awt.event.ItemEvent evt)
Respond when user chooses an example from the example menu. |
protected WcmAxes |
makeAxes()
Construct a set of Axes, based on applet params "AxesColor", "AxesLightColor", "XLabel", "YLabel", "LabelColor". |
protected TableFunction |
parseTableFuncDef(java.lang.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. |
Methods inherited from class javax.swing.JApplet |
---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.applet.Applet |
---|
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, 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, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Parser parser
protected WcmPanel mainPanel
protected Controller mainController
protected DisplayCanvas canvas
protected LimitControlPanel limitsPanel
protected ExpressionInput functionInput
protected Variable xVar
protected WcmPanel inputPanel
protected WcmPanel exampleMenuPanel
protected javax.swing.JButton computeButton
protected java.lang.String frameTitle
protected int[] defaultFrameSize
protected float fontSize
protected boolean presentation
protected java.util.Hashtable parameterDefaults
protected java.awt.Color ggBGColor
protected java.awt.Color ggFGColor
protected java.awt.Color pBGColor
protected java.awt.Font lbf
Constructor Detail |
---|
public GenericGraphApplet()
Method Detail |
---|
public void init()
init
in class java.applet.Applet
protected void setUpMainPanel()
protected void doLoadFirstExample()
protected void setUpCanvas()
protected WcmAxes makeAxes()
protected void addCanvasBorder()
protected void setUpBottomPanel()
protected void setUpLimitsPanel()
protected void setUpTopPanel()
protected void setUpExampleMenu()
protected void setUpParser()
protected void doLoadExample(java.lang.String example)
example
- the function to be graphedprotected void setUpParameterDefaults()
public java.lang.String getParameter(java.lang.String paramName)
getParameter
in class java.applet.Applet
paramName
- the parameter to get
protected java.lang.String getParameter(java.lang.String paramName, java.lang.String defaultValue)
paramName
- The name of the applet parameter.defaultValue
- The value to be returned if getParameter(paramName) is null.
protected double[] getNumericParam(java.lang.String paramName)
paramName
- the name of the parameter to get
protected double[] getNumericParam(java.lang.String paramName, double[] defaults)
paramName
- The name of the applet parameter.defaults
- The value to be returned if getParameter(paramName) is null or
is not a valid list of numbers.
protected java.awt.Color getColorParam(java.lang.String data)
data
- the name of the parameter
protected java.awt.Color getColorParam(java.lang.String paramName, java.awt.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 destroy()
destroy
in class java.applet.Applet
protected TableFunction parseTableFuncDef(java.lang.String def)
def
- string that defines the TableFunction to create
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- event generated when user clicks a buttonpublic void itemStateChanged(java.awt.event.ItemEvent evt)
itemStateChanged
in interface java.awt.event.ItemListener
evt
- event created when user makes a menu selection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |