rvl.piface
Class Piface

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--rvl.piface.Piface
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, Closeable, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.awt.event.WindowListener
Direct Known Subclasses:
AboutPiface, AnovaCompGUI, AnovaGUI, AnovaHelper, AnovaPicker, GenericChi2GUI, ModelessMsgBox, OnePCIGUI, OnePGUI, OneTCIGUI, OneTGUI, TEquivGUI, TwoPGUI, TwoTFlex, TwoTGUI

public abstract class Piface
extends java.awt.Frame
implements java.awt.event.ActionListener, java.awt.event.WindowListener, Closeable

Abstract class for simple construction a graphical interface. Subclasses need the following methods:

      public void gui()       // to construct components
      public void click()     // default event handler
      public void var_changed  // event handler for var
 
For convenience, several component-adding methods are provided for use in gui(). These methods include slider(), bar(), interval(), checkbox(), and choice() -- each in several versions. The methods add listeners for the components and arrange them in column(s) in the order that they are called. To start a new column, call newColumn(). The current column is a PiPanel named "panel", which may be manipulated directly in gui() as needed. The interface works like this: Whenever a variable var is changed by user action, the value of that variable is set accordingly in this object. If a method named var_changed exists, it is called; otherwise, click() is called as the default event handler. Finally, all graphical components are updated to reflect the new values of all the variables. A large collection of mathematical functions are provided in this class, so that subclasses need not prefix them (e.g., we may call "log" rather than "Math.log".)

See Also:
Serialized Form

Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.lang.String actionSource
           
protected  java.util.Vector actors
           
protected  java.awt.Font bigFont
           
protected  java.awt.Font boldFont
           
protected  java.awt.Menu helpMenu
           
 double javaVersion
           
protected  java.util.Vector listeners
           
protected  java.awt.MenuBar menuBar
           
protected  java.awt.Menu optMenu
           
protected  PiPanel panel
           
protected  java.util.Vector panels
           
protected  int sourceIndex
           
static java.lang.String version
           
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
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
Piface()
          Piface constructor
Piface(java.lang.String title)
          Piface constructor - puts title on top bar
Piface(java.lang.String title, boolean build)
          Piface constructor - puts title on top bar conditionally builds GUI
 
Method Summary
 void aboutPiface()
           
static double abs(double x)
           
static int abs(int x)
           
static double acos(double x)
           
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addComponent(java.lang.String methodName, java.awt.Component comp)
          Add an action-generating component.
 void addComponent(java.lang.String methodName, java.lang.String label, java.awt.Component comp)
          Add an action-generating component to the current panel, and register it as an ActionComponent for event handling by named method.
 void addPiListener(PiListener pil)
           
 void addVar(java.lang.String name, DoubleComponent comp, double value)
          Add an action-generating component to the current panel, add an ActionListener for it, and register the variable for event handling.
 void addVar(java.lang.String name, IntComponent comp, int value)
          Add an action-generating component to the current panel, add an ActionListener for it, and register the variable for event handling.
protected  void afterSetup()
          Called after setting up the GUI and just before showing it.
 PiArrayField arrayField(java.lang.String method, java.lang.String label, double[] value)
           
 PiArrayField arrayField(java.lang.String method, java.lang.String label, double[] value, int width)
          Array fields -- enter lists of numbers This works like, e.g., a button.
static double asin(double x)
           
static double atan(double x)
           
static double atan(double x, double y)
           
static double atan2(double x, double y)
           
 void bar(java.lang.String name, double value)
           
 void bar(java.lang.String name, double value, int digits)
           
 void bar(java.lang.String name, java.lang.String label, double value)
           
 void bar(java.lang.String name, java.lang.String label, double value, int digits)
           
protected  void beforeSetup()
          Called before setting up the GUI.
 void beginSubpanel(int columns)
           
 void beginSubpanel(int columns, boolean raised)
           
 void beginSubpanel(int columns, java.awt.Color borderColor)
           
 void border(java.awt.Color color)
           
 void build()
          Build the GUI.
 void button(java.lang.String methodName, java.lang.String label)
           
 void callMethod(java.lang.String methodName)
          Calls public void MethodName()
 void callMethodFor(java.lang.String name)
          Calls method _changed() if it exists, otherwise calls click()
static double ceil(double x)
           
 void checkbox(java.lang.String name, int value)
           
 void checkbox(java.lang.String name, java.lang.String label, int value)
          Checkboxes
 void choice(java.lang.String name, double[] items, int index)
           
 void choice(java.lang.String name, java.lang.String[] items, int value)
           
 void choice(java.lang.String name, java.lang.String label, double[] items, int index)
           
 void choice(java.lang.String name, java.lang.String label, java.lang.String[] items, int value)
          Choices (drop-down lists) Note that these come in 2 varieties.
 void click()
          Required method -- default event-handler
 void close()
          Close this GUI
 void component(java.lang.String methodName, java.awt.Component comp)
          Identical to addComponent
 void component(java.lang.String methodName, java.lang.String label, java.awt.Component comp)
          Identical to addComponent
static double cos(double x)
           
 PiDotplot dotplot(java.lang.String method, java.lang.String label, double[] value)
          Dotplot field -- works like arrayField but uses a graphical style of inputting data.
 void endSubpanel()
           
 void errmsg(java.lang.String msg)
          Non-fatal error message
 void errmsg(java.lang.String methName, java.lang.String desc)
          Non-fatal error message
 void errmsg(java.lang.String methName, java.lang.String desc, boolean fatal)
          Display an error message in the form methName: desc.
protected  double eval(java.lang.String yName, java.lang.String xName, double xVal)
           
static double exp(double x)
           
static boolean feq(double x, double y)
           
static boolean feq(double x, double y, double eps)
           
 void field(java.lang.String name, double value)
           
 void field(java.lang.String name, java.lang.String label, double value)
           
 void field(java.lang.String name, java.lang.String label, double value, int width, int digits)
          Value-entry fields
 void filler()
           
static double floor(double x)
           
 PiComponent getComponent(java.lang.String name)
           
protected  double getDVar(java.lang.Object[] info)
          Get an element of a named double[] variable using reflection
protected  double getDVar(java.lang.String name)
          Get the value of a named double variable using reflection Also accesses an array element if the name ~ "var[index]"
protected  int getIVar(java.lang.Object[] info)
          Get an element of a named int[] variable using reflection
protected  int getIVar(java.lang.String name)
          Get the value of a named int variable using reflection
 java.awt.Component getMaster()
           
static java.lang.String getVersion()
           
 void gui()
          Required method -- define the gui using calls to methods like addVar()
 void guiHelp()
           
 void hradio(java.lang.String name, java.lang.String[] items, int value)
           
 void hradio(java.lang.String name, java.lang.String label, java.lang.String[] items, int value)
           
 void interval(java.lang.String name, double value, double minVal, double maxVal)
           
 void interval(java.lang.String name, java.lang.String label, double value, double minVal, double maxVal)
           
 void label(java.lang.String label)
           
 void label(java.lang.String label, java.awt.Font font)
          Labels
static double log(double x)
           
static double log10(double x)
           
static double max(double x, double y)
           
static int max(int x, int y)
           
 void menuCheckbox(java.lang.String name, int value)
           
 void menuCheckbox(java.lang.String name, int value, java.awt.Menu menu)
           
 void menuCheckbox(java.lang.String name, java.lang.String label, int value)
           
 void menuCheckbox(java.lang.String name, java.lang.String label, int value, java.awt.Menu menu)
          Checkbox menu items
 void menuItem(java.lang.String methodName, java.lang.String label)
           
 void menuItem(java.lang.String methodName, java.lang.String label, java.awt.Menu menu)
           
static double min(double x, double y)
           
static int min(int x, int y)
           
 void newColumn()
          Add a new panel to the gui
 void notifyListeners(java.lang.String varName)
          Notify all the listeners of a value change Current variables are saved and restored before and after each call to keep things orderly
 void notifyListeners(java.lang.String varName, PiListener caller)
          Notify all the listeners of a value change Current variables are saved and restored before and after each call to keep things orderly.
static double nrand()
           
 void obar(java.lang.String name, double value)
           
 void obar(java.lang.String name, double value, int digits)
           
 void obar(java.lang.String name, java.lang.String label, double value)
           
 void obar(java.lang.String name, java.lang.String label, double value, int digits)
           
 void ofield(java.lang.String name, double value)
           
 void ofield(java.lang.String name, java.lang.String label, double value)
           
 void ofield(java.lang.String name, java.lang.String label, double value, int width, int digits)
           
 void ointerval(java.lang.String name, double value, double minVal, double maxVal)
           
 void ointerval(java.lang.String name, java.lang.String label, double value, double minVal, double maxVal)
           
 void oslider(java.lang.String name, double value)
           
 void oslider(java.lang.String name, double value, int digits)
           
 void oslider(java.lang.String name, java.lang.String label, double value)
           
 void oslider(java.lang.String name, java.lang.String label, double value, int digits)
           
 void otext(java.lang.String name, java.lang.String label, double value)
           
 void otext(java.lang.String name, java.lang.String label, double value, int digits)
           
static double pow(double x, double e)
           
 void radio(java.lang.String name, java.lang.String label, java.lang.String[] items, int value, int columns)
          Radio buttons - value is index (0-based) of selected button Usually you'll want hradio() or vradio() for horizontal or vertical arrangements; but you may use radio() to specify something in between.
static double random()
           
 void relabel(java.lang.String name, java.lang.String newLabel)
          Re-label a component
 void removePiListener(PiListener pil)
           
 void restoreVars(double[] saved)
           
static long round(double x)
           
static double round(double x, int places)
           
 double[] saveVars()
          Returns all local variables -- so that we can later restore everything using restoreVars()
static double seed()
          Initialize with system clock
static double seed(double s)
          Initialize with given seed
 void set3D(boolean raised)
           
 void setMaster(java.awt.Component p)
          Set master to p.
protected  void setVar(java.lang.Object[] info, double value)
          Set an element of a double[] variable to a value using reflection
protected  void setVar(java.lang.Object[] info, int value)
          Set an element of an int[] variable to a value using reflection
protected  void setVar(java.lang.String name, double value)
          Set a double variable to a value using reflection
protected  void setVar(java.lang.String name, int value)
          Set an integer variable to a value using reflection
protected  void setVar(java.lang.String varName, Piface piface)
          Set a local variable, if it exists, to the same value as it has in the Piface object piface
 void setVisible(java.lang.String name, boolean v)
          Make the named component visible or invisible
 rvl.awt.ViewWindow showText(java.lang.Class clas, java.lang.String filename, java.lang.String title, int rows, int cols)
          Display text from a file in a separate window The file should be in the same directory as clas
 rvl.awt.ViewWindow showText(java.lang.String text, java.lang.String title, int rows, int cols)
          Display text in a separate window
static int sign(double x)
           
static double sin(double x)
           
 void slider(java.lang.String name, double value)
           
 void slider(java.lang.String name, double value, int digits)
           
 void slider(java.lang.String name, java.lang.String label, double value)
           
 void slider(java.lang.String name, java.lang.String label, double value, double minVal, double maxVal, int digits, boolean hardMin, boolean hardMax, boolean editable)
          Sliders
 void slider(java.lang.String name, java.lang.String label, double value, int digits)
           
 double solve(PifaceAux pfa, double target, double xStart, double xIncr)
          This is exactly like solve(String, String, ...) except it is used with a previously constructed PifaceAux object.
 double solve(java.lang.String xName, java.lang.String yName, double target, double xStart, double xIncr)
           
static double sqrt(double x)
           
 void stackTrace(java.lang.Throwable t)
          Fatal error with stack trace
static double tan(double x)
           
static double time()
           
 void updateVars()
          Update values of all components to current values
 void vradio(java.lang.String name, java.lang.String[] items, int value)
           
 void vradio(java.lang.String name, java.lang.String label, java.lang.String[] items, int value)
           
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, paramString, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

version

public static final java.lang.String version

javaVersion

public double javaVersion

panels

protected java.util.Vector panels

actors

protected java.util.Vector actors

listeners

protected java.util.Vector listeners

panel

protected PiPanel panel

menuBar

protected java.awt.MenuBar menuBar

optMenu

protected java.awt.Menu optMenu

helpMenu

protected java.awt.Menu helpMenu

boldFont

protected java.awt.Font boldFont

bigFont

protected java.awt.Font bigFont

actionSource

protected java.lang.String actionSource

sourceIndex

protected int sourceIndex
Constructor Detail

Piface

public Piface()
Piface constructor

Piface

public Piface(java.lang.String title)
Piface constructor - puts title on top bar

Piface

public Piface(java.lang.String title,
              boolean build)
Piface constructor - puts title on top bar conditionally builds GUI
Method Detail

getVersion

public static java.lang.String getVersion()

build

public void build()
Build the GUI. Subclass constructors should either simply call Piface's constructor, or set stuff up and then call build().

errmsg

public void errmsg(java.lang.String methName,
                   java.lang.String desc,
                   boolean fatal)
Display an error message in the form methName: desc. If only want one-part message, call with desc=null May override this as needed.

errmsg

public void errmsg(java.lang.String methName,
                   java.lang.String desc)
Non-fatal error message

errmsg

public void errmsg(java.lang.String msg)
Non-fatal error message

stackTrace

public void stackTrace(java.lang.Throwable t)
Fatal error with stack trace

close

public void close()
Close this GUI
Specified by:
close in interface Closeable

addComponent

public void addComponent(java.lang.String methodName,
                         java.lang.String label,
                         java.awt.Component comp)
Add an action-generating component to the current panel, and register it as an ActionComponent for event handling by named method.
Parameters:
methodName - java.lang.String -- name of event handler for this component
label - java.awt.Component -- label assigned to component (this does not show anywhere in the GUI, but actionSource is set to this label and so it may be used to identify the event).
comp - java.awt.Component -- component to be added

addComponent

public void addComponent(java.lang.String methodName,
                         java.awt.Component comp)
Add an action-generating component. Same as addComponent(methodName, methodName, comp)

addVar

public void addVar(java.lang.String name,
                   DoubleComponent comp,
                   double value)
Add an action-generating component to the current panel, add an ActionListener for it, and register the variable for event handling.
Parameters:
name - java.lang.String -- name of a double variable
comp - rvl.piface.DoubleComponent
value - double

addVar

public void addVar(java.lang.String name,
                   IntComponent comp,
                   int value)
Add an action-generating component to the current panel, add an ActionListener for it, and register the variable for event handling.
Parameters:
name - java.lang.String -- name of an int variable
comp - rvl.piface.IntComponent
value - double

click

public void click()
Required method -- default event-handler

gui

public void gui()
Required method -- define the gui using calls to methods like addVar()

beforeSetup

protected void beforeSetup()
Called before setting up the GUI. Override to initialize variables or to remove menu items that are automatically added before calling gui()

afterSetup

protected void afterSetup()
Called after setting up the GUI and just before showing it. Override to permit last-minute changes (e.g., removing menu items that are automatically added after calling gui()

setVar

protected void setVar(java.lang.String name,
                      double value)
Set a double variable to a value using reflection
Parameters:
name - java.lang.String
value - double

getDVar

protected double getDVar(java.lang.String name)
Get the value of a named double variable using reflection Also accesses an array element if the name ~ "var[index]"

setVar

protected void setVar(java.lang.Object[] info,
                      double value)
Set an element of a double[] variable to a value using reflection
Parameters:
info[] - contains {String name, Integer index}
value - double

getDVar

protected double getDVar(java.lang.Object[] info)
Get an element of a named double[] variable using reflection

setVar

protected void setVar(java.lang.String name,
                      int value)
Set an integer variable to a value using reflection
Parameters:
name - java.lang.String
value - int

getIVar

protected int getIVar(java.lang.String name)
Get the value of a named int variable using reflection

setVar

protected void setVar(java.lang.Object[] info,
                      int value)
Set an element of an int[] variable to a value using reflection
Parameters:
info[] - contains {String name, Integer index}
value - double

getIVar

protected int getIVar(java.lang.Object[] info)
Get an element of a named int[] variable using reflection

setVar

protected void setVar(java.lang.String varName,
                      Piface piface)
Set a local variable, if it exists, to the same value as it has in the Piface object piface

callMethod

public void callMethod(java.lang.String methodName)
Calls public void MethodName()

callMethodFor

public void callMethodFor(java.lang.String name)
Calls method _changed() if it exists, otherwise calls click()

updateVars

public void updateVars()
Update values of all components to current values

newColumn

public void newColumn()
Add a new panel to the gui

beginSubpanel

public void beginSubpanel(int columns)

beginSubpanel

public void beginSubpanel(int columns,
                          java.awt.Color borderColor)

beginSubpanel

public void beginSubpanel(int columns,
                          boolean raised)

endSubpanel

public void endSubpanel()

border

public void border(java.awt.Color color)

set3D

public void set3D(boolean raised)

filler

public void filler()

guiHelp

public void guiHelp()

aboutPiface

public void aboutPiface()

showText

public rvl.awt.ViewWindow showText(java.lang.String text,
                                   java.lang.String title,
                                   int rows,
                                   int cols)
Display text in a separate window

showText

public rvl.awt.ViewWindow showText(java.lang.Class clas,
                                   java.lang.String filename,
                                   java.lang.String title,
                                   int rows,
                                   int cols)
Display text from a file in a separate window The file should be in the same directory as clas

solve

public double solve(java.lang.String xName,
                    java.lang.String yName,
                    double target,
                    double xStart,
                    double xIncr)
Returns:
the value for xName such that yName's value is equal to target. The starting values used by the numerical method are xStart and xStart + xIncr. This places no restrictions on the solution. To place restrictions or control on solutions, first create a PifaceAux object, place the restrictions, and call solve(PifaceAux, ...)

solve

public double solve(PifaceAux pfa,
                    double target,
                    double xStart,
                    double xIncr)
This is exactly like solve(String, String, ...) except it is used with a previously constructed PifaceAux object.

getComponent

public PiComponent getComponent(java.lang.String name)
Returns:
the Component associated with the named variable. Note it's possible that more than one such component exists; if so, we return the first one found.

setVisible

public void setVisible(java.lang.String name,
                       boolean v)
Make the named component visible or invisible

relabel

public void relabel(java.lang.String name,
                    java.lang.String newLabel)
Re-label a component

label

public void label(java.lang.String label,
                  java.awt.Font font)
Labels

label

public void label(java.lang.String label)

slider

public void slider(java.lang.String name,
                   java.lang.String label,
                   double value,
                   double minVal,
                   double maxVal,
                   int digits,
                   boolean hardMin,
                   boolean hardMax,
                   boolean editable)
Sliders

slider

public void slider(java.lang.String name,
                   java.lang.String label,
                   double value,
                   int digits)

slider

public void slider(java.lang.String name,
                   java.lang.String label,
                   double value)

slider

public void slider(java.lang.String name,
                   double value,
                   int digits)

slider

public void slider(java.lang.String name,
                   double value)

bar

public void bar(java.lang.String name,
                java.lang.String label,
                double value,
                int digits)

bar

public void bar(java.lang.String name,
                java.lang.String label,
                double value)

bar

public void bar(java.lang.String name,
                double value)

bar

public void bar(java.lang.String name,
                double value,
                int digits)

interval

public void interval(java.lang.String name,
                     java.lang.String label,
                     double value,
                     double minVal,
                     double maxVal)

interval

public void interval(java.lang.String name,
                     double value,
                     double minVal,
                     double maxVal)

oslider

public void oslider(java.lang.String name,
                    java.lang.String label,
                    double value,
                    int digits)

oslider

public void oslider(java.lang.String name,
                    double value,
                    int digits)

oslider

public void oslider(java.lang.String name,
                    java.lang.String label,
                    double value)

oslider

public void oslider(java.lang.String name,
                    double value)

obar

public void obar(java.lang.String name,
                 java.lang.String label,
                 double value,
                 int digits)

obar

public void obar(java.lang.String name,
                 java.lang.String label,
                 double value)

obar

public void obar(java.lang.String name,
                 double value)

obar

public void obar(java.lang.String name,
                 double value,
                 int digits)

ointerval

public void ointerval(java.lang.String name,
                      java.lang.String label,
                      double value,
                      double minVal,
                      double maxVal)

ointerval

public void ointerval(java.lang.String name,
                      double value,
                      double minVal,
                      double maxVal)

field

public void field(java.lang.String name,
                  java.lang.String label,
                  double value,
                  int width,
                  int digits)
Value-entry fields

field

public void field(java.lang.String name,
                  java.lang.String label,
                  double value)

field

public void field(java.lang.String name,
                  double value)

ofield

public void ofield(java.lang.String name,
                   java.lang.String label,
                   double value,
                   int width,
                   int digits)

ofield

public void ofield(java.lang.String name,
                   java.lang.String label,
                   double value)

ofield

public void ofield(java.lang.String name,
                   double value)

otext

public void otext(java.lang.String name,
                  java.lang.String label,
                  double value,
                  int digits)

otext

public void otext(java.lang.String name,
                  java.lang.String label,
                  double value)

arrayField

public PiArrayField arrayField(java.lang.String method,
                               java.lang.String label,
                               double[] value,
                               int width)
Array fields -- enter lists of numbers This works like, e.g., a button. You supply a method to invoke when it is called. That method is responsible for retrieving the value using double [] getValue().

arrayField

public PiArrayField arrayField(java.lang.String method,
                               java.lang.String label,
                               double[] value)

dotplot

public PiDotplot dotplot(java.lang.String method,
                         java.lang.String label,
                         double[] value)
Dotplot field -- works like arrayField but uses a graphical style of inputting data. You supply a method to invoke when a dot is moved. That method is responsible for retrieving the value using double [] getValue(). Note: If label is "", the display takes up less vertical space.

checkbox

public void checkbox(java.lang.String name,
                     java.lang.String label,
                     int value)
Checkboxes

checkbox

public void checkbox(java.lang.String name,
                     int value)

menuCheckbox

public void menuCheckbox(java.lang.String name,
                         java.lang.String label,
                         int value,
                         java.awt.Menu menu)
Checkbox menu items

menuCheckbox

public void menuCheckbox(java.lang.String name,
                         java.lang.String label,
                         int value)

menuCheckbox

public void menuCheckbox(java.lang.String name,
                         int value,
                         java.awt.Menu menu)

menuCheckbox

public void menuCheckbox(java.lang.String name,
                         int value)

choice

public void choice(java.lang.String name,
                   java.lang.String label,
                   java.lang.String[] items,
                   int value)
Choices (drop-down lists) Note that these come in 2 varieties. When the items[] argument is String[], the associated variable is an integer equal to the index (0-based) of the selected item. When items[] is double[], the associated variable is a double equal to the selected value (provide the index of the desired starting value). If the code attempts to set a double choice variable, the closest one in items[] is used.

choice

public void choice(java.lang.String name,
                   java.lang.String[] items,
                   int value)

choice

public void choice(java.lang.String name,
                   java.lang.String label,
                   double[] items,
                   int index)

choice

public void choice(java.lang.String name,
                   double[] items,
                   int index)

radio

public void radio(java.lang.String name,
                  java.lang.String label,
                  java.lang.String[] items,
                  int value,
                  int columns)
Radio buttons - value is index (0-based) of selected button Usually you'll want hradio() or vradio() for horizontal or vertical arrangements; but you may use radio() to specify something in between. An empty string ("") makes a blank position in the grid; for example, if items[] = {"","choice 1","choice 2"} and columns = 2, the buttons will be arranged in a row below the label. SKIP all blank entries when figuring the index of a button; in the above example, "choice 1" corresponds to value 0.

hradio

public void hradio(java.lang.String name,
                   java.lang.String label,
                   java.lang.String[] items,
                   int value)

hradio

public void hradio(java.lang.String name,
                   java.lang.String[] items,
                   int value)

vradio

public void vradio(java.lang.String name,
                   java.lang.String label,
                   java.lang.String[] items,
                   int value)

vradio

public void vradio(java.lang.String name,
                   java.lang.String[] items,
                   int value)

button

public void button(java.lang.String methodName,
                   java.lang.String label)

menuItem

public void menuItem(java.lang.String methodName,
                     java.lang.String label,
                     java.awt.Menu menu)

menuItem

public void menuItem(java.lang.String methodName,
                     java.lang.String label)

component

public void component(java.lang.String methodName,
                      java.lang.String label,
                      java.awt.Component comp)
Identical to addComponent
See Also:
addComponent(java.lang.String, java.lang.String, java.awt.Component)

component

public void component(java.lang.String methodName,
                      java.awt.Component comp)
Identical to addComponent
See Also:
addComponent(java.lang.String, java.lang.String, java.awt.Component)

addPiListener

public void addPiListener(PiListener pil)

removePiListener

public void removePiListener(PiListener pil)

notifyListeners

public void notifyListeners(java.lang.String varName)
Notify all the listeners of a value change Current variables are saved and restored before and after each call to keep things orderly

notifyListeners

public void notifyListeners(java.lang.String varName,
                            PiListener caller)
Notify all the listeners of a value change Current variables are saved and restored before and after each call to keep things orderly. If any registered PiListener is the same as caller, it is not notified (presumably the caller already knows!).

saveVars

public double[] saveVars()
Returns all local variables -- so that we can later restore everything using restoreVars()

restoreVars

public void restoreVars(double[] saved)

eval

protected double eval(java.lang.String yName,
                      java.lang.String xName,
                      double xVal)
Returns:
value of variable named yName after processing with variable named xName set to xVal. Normally, should call saveVars() before calling this, and call restoreVars() after finishing.

setMaster

public void setMaster(java.awt.Component p)
Set master to p. Affects behavior on closing. If master is null, close() calls System.exit; otherwise, it is assumed that the master will take care of the problem if it's all that fatal.

getMaster

public java.awt.Component getMaster()
Returns:
master component

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

sin

public static double sin(double x)

cos

public static double cos(double x)

tan

public static double tan(double x)

asin

public static double asin(double x)

acos

public static double acos(double x)

atan

public static double atan(double x)

atan

public static double atan(double x,
                          double y)

atan2

public static double atan2(double x,
                           double y)

log

public static double log(double x)

log10

public static double log10(double x)

exp

public static double exp(double x)

sqrt

public static double sqrt(double x)

round

public static long round(double x)

round

public static double round(double x,
                           int places)

pow

public static double pow(double x,
                         double e)

abs

public static int abs(int x)

abs

public static double abs(double x)

floor

public static double floor(double x)

ceil

public static double ceil(double x)

max

public static double max(double x,
                         double y)

min

public static double min(double x,
                         double y)

max

public static int max(int x,
                      int y)

min

public static int min(int x,
                      int y)

sign

public static int sign(double x)

feq

public static boolean feq(double x,
                          double y,
                          double eps)

feq

public static boolean feq(double x,
                          double y)

time

public static double time()

random

public static double random()
Returns:
a U(0,1) random number

nrand

public static double nrand()
Returns:
a N(0,1) random number

seed

public static double seed(double s)
Initialize with given seed

seed

public static double seed()
Initialize with system clock