edu.princeton.toy
public class TFrame extends javax.swing.JFrame implements java.awt.event.ActionListener, javax.swing.event.ChangeListener, java.awt.event.TextListener, javax.swing.event.ListSelectionListener, TVirtualMachine.ExecutionController
| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | TFrame.RunnerRunner is the implementation of Runnable which updates the warnings of all TFrames (if the
 program had changed since the last syntax check). | 
| protected class  | TFrame.TFrameActionTFrameAction is a generalizable action for the TFrame; basically, it relays all ActionEvents
 to the doCommand() method. | 
| static class  | TFrame.WorkspaceMenuItemTWorkspaceMenuItem is a simple subclass of JRadioButtonMenuItem which keeps an index
 property. | 
javax.swing.JFrame.AccessibleJFrame| Modifier and Type | Field and Description | 
|---|---|
| static int | CASCADE_XThe displacement in the x direction between cascaded windows. | 
| static int | CASCADE_YThe displacement in the y direction between cascaded windows. | 
| static java.lang.String | CHANGE_CHECKING_COMMAND | 
| static java.lang.String | CHANGE_EXECUTION_COMMAND | 
| static java.lang.String | CHECK_SYNTAX_COMMAND | 
| static java.lang.String | CLEAR_ODOMETER_COMMAND | 
| static java.lang.String | CLOSE_COMMAND | 
| static java.lang.String | DEBUG_MODE_COMMAND | 
| static java.lang.String | EDIT_MODE_COMMAND | 
| static java.lang.String | ENTER_COMMAND | 
| static java.lang.String | FUNCTION_COMMAND | 
| static java.lang.String | HIDE_WARNINGS_COMMAND | 
| static java.lang.String | INTERRUPT_COMMAND | 
| static java.lang.String | LOAD_COMMAND | 
| static java.lang.String | LOOK_COMMAND | 
| static java.lang.String | NEW_COMMAND | 
| static java.lang.String | OPEN_COMMAND | 
| static java.lang.String | OPEN_EXAMPLE_COMMAND | 
| static java.lang.String | OPEN_STDIN_COMMAND | 
| static java.lang.String | QUIT_COMMAND | 
| static java.lang.String | RESET_COMMAND | 
| static java.lang.String | REVERT_COMMAND | 
| static java.lang.String | RUN_COMMAND | 
| static java.lang.String | SAVE_AS_COMMAND | 
| static java.lang.String | SAVE_COMMAND | 
| static java.lang.String | SAVE_CORE_DUMP_COMMAND | 
| static java.lang.String | SAVE_MEM_DUMP_COMMAND | 
| static java.lang.String | SAVE_STDIN_COMMAND | 
| static java.lang.String | SAVE_STDOUT_COMMAND | 
| static java.lang.String | SIM_MODE_COMMAND | 
| static java.lang.String | STEP_COMMAND | 
| static java.lang.String | WORKSPACE_COMMAND | 
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabledCROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, 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_CURSORBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description | 
|---|
| TFrame() | 
| TFrame(TProgramDocument program) | 
| TFrame(TProgramDocument program,
      java.io.File file) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | actionPerformed(java.awt.event.ActionEvent e)Implement ActionListener to pass the command onto doCommand(). | 
| static TFrame | createInitialFrame()Creates the first frame, initializing locations and bounds from the TOptionFrame's memory
 of the last closed TFrame. | 
| void | dispose()Override this method to prevent unclean disposals. | 
| boolean | doCommand(java.lang.String command,
         java.lang.Object extraInfo)Performs a command based on the argument. | 
| int | getClockPeriod()This function is called by the TVirtualMachine's runner after it has recieved an order
 for a batch of steps to be run. | 
| protected void | processWindowEvent(java.awt.event.WindowEvent e)Intercept WindowEvents to pick up WINDOW_CLOSING events. | 
| static void | setAutoCheck(boolean autoCheck)Starts or stops the auto-syntax-check runner. | 
| void | stateChanged(javax.swing.event.ChangeEvent e)Implement ChangeListener to listen to changes in the state of the virtual machine. | 
| int | statusUpdate(TVirtualMachine virtualMachine,
            int n,
            int elapsedTime,
            boolean willStop)This function is called by the TVirtualMachine's runner when it has completed the
 previous batch of steps. | 
| void | textValueChanged(java.awt.event.TextEvent e)Implement TextListener to update the other components when the document changes. | 
| void | valueChanged(javax.swing.event.ListSelectionEvent e)Implement ListSelectionListener to update the editTextArea selection when the list's selection
 changes. | 
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateaddNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecoratedaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFrontadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeaction, 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, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int CASCADE_X
public static final int CASCADE_Y
public static final java.lang.String NEW_COMMAND
public static final java.lang.String OPEN_COMMAND
public static final java.lang.String OPEN_EXAMPLE_COMMAND
public static final java.lang.String CLOSE_COMMAND
public static final java.lang.String REVERT_COMMAND
public static final java.lang.String SAVE_COMMAND
public static final java.lang.String SAVE_AS_COMMAND
public static final java.lang.String QUIT_COMMAND
public static final java.lang.String EDIT_MODE_COMMAND
public static final java.lang.String DEBUG_MODE_COMMAND
public static final java.lang.String SIM_MODE_COMMAND
public static final java.lang.String LOOK_COMMAND
public static final java.lang.String LOAD_COMMAND
public static final java.lang.String RESET_COMMAND
public static final java.lang.String STEP_COMMAND
public static final java.lang.String RUN_COMMAND
public static final java.lang.String INTERRUPT_COMMAND
public static final java.lang.String ENTER_COMMAND
public static final java.lang.String OPEN_STDIN_COMMAND
public static final java.lang.String SAVE_STDIN_COMMAND
public static final java.lang.String SAVE_STDOUT_COMMAND
public static final java.lang.String SAVE_MEM_DUMP_COMMAND
public static final java.lang.String SAVE_CORE_DUMP_COMMAND
public static final java.lang.String WORKSPACE_COMMAND
public static final java.lang.String CHECK_SYNTAX_COMMAND
public static final java.lang.String FUNCTION_COMMAND
public static final java.lang.String CHANGE_EXECUTION_COMMAND
public static final java.lang.String CLEAR_ODOMETER_COMMAND
public static final java.lang.String CHANGE_CHECKING_COMMAND
public static final java.lang.String HIDE_WARNINGS_COMMAND
public TFrame()
public TFrame(TProgramDocument program)
public TFrame(TProgramDocument program, java.io.File file)
public void dispose()
dispose in class java.awt.Windowpublic static void setAutoCheck(boolean autoCheck)
autoCheck - Wheter or not the auto-syntax-check runner should be running.public static TFrame createInitialFrame()
public boolean doCommand(java.lang.String command,
                java.lang.Object extraInfo)
command - A string representing the command.  Note that pointer equality (not string
 equality) is tested here, so it is important to use the string constants defined in this
 class.  TFrame.WORKSPACE_COMMAND requires an integer to be appended to it in order to
 distinguish between the arbitrarily large number of other workspaces.  An
 IllegalArgumentException will be thrown if the argument is invalid.extraInfo - Any extra information necessary.  This is specific to the command:
 public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerdoCommand(String, Object)public void textValueChanged(java.awt.event.TextEvent e)
textValueChanged in interface java.awt.event.TextListenerpublic void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged in interface javax.swing.event.ListSelectionListenerpublic void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged in interface javax.swing.event.ChangeListenerpublic int statusUpdate(TVirtualMachine virtualMachine, int n, int elapsedTime, boolean willStop)
statusUpdate in interface TVirtualMachine.ExecutionControllervirtualMachine - The virtual machine whose status is being reported.n - The number of steps taken since the last update.elapsedTime - The number of milliseconds between the lastUpdate and the present.willStop - Wheter or not the TVirtualMachine will stop after this status update.public int getClockPeriod()
getClockPeriod in interface TVirtualMachine.ExecutionControllerprotected void processWindowEvent(java.awt.event.WindowEvent e)
processWindowEvent in class javax.swing.JFrame