edu.princeton.toy
Class TOptionsFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by edu.princeton.toy.TOptionsFrame
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TreeSelectionListener, RootPaneContainer, WindowConstants

public class TOptionsFrame
extends JFrame
implements ActionListener, TreeSelectionListener

See Also:
Serialized Form

Nested Class Summary
protected static class TOptionsFrame.FileHistoryAction
          FileHistoryAction is an action for opening a file that had been opened in the past.
protected static class TOptionsFrame.IntStruct
          IntStruct is a simple structure that encapsulates an integer.
protected static class TOptionsFrame.OptionsAction
          OptionsAction is an action for showing the TOptionFrame instance.
protected  class TOptionsFrame.ShutdownHook
          ShutdownHook implements Runnable to store the TOptionsFrame's parameters upon exit.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String APPLY_COMMAND
           
static String AUTO_CHECK_KEY
          The key for wheter or not to automatically check the user's syntax as he types.
static String AUTO_COMPLETER_KEY
          The key for the autocompleter entry.
static String[] AUTO_COMPLETER_NAMES
          The names for the AutoCompleters in the AUTO_COMPLETERS array.
static AutoCompleter[] AUTO_COMPLETERS
          A set of AutoCompleters which can be used by a PHighlightedTextArea.
static int BACKGROUND_COLOR_INDEX
           
static String CANCEL_COMMAND
           
static int CARET_COLOR_INDEX
           
static String CLOCK_PERIOD_KEY
          The key for the clock periods.
static int[] CLOCK_PERIODS
          The possible values for the clock periods.
static String[] COLOR_COLOR_KEYS
           
static String[] COLOR_DISABLED_DESCRIPTIONS
           
static String[] COLOR_DISABLED_KEYS
           
static String[] COLOR_NAMES
           
static int COLUMN_MARKERS_COLOR_INDEX
           
static int CORE_AREA_INDEX
           
static String CURRENT_DIRECTORY_KEY
           
static String DEFAULTS_COMMAND
           
static DefaultMutableTreeNode EDITING_AUTO_COMPLETE_NODE
           
static DefaultMutableTreeNode EDITING_CHECKING_NODE
           
static DefaultMutableTreeNode EDITING_COLORS_NODE
           
static DefaultMutableTreeNode EDITING_FONTS_NODE
           
static DefaultMutableTreeNode EDITING_HIGHLIGHTING_NODE
           
static DefaultMutableTreeNode EDITING_NODE
           
static String[] EXCEPTION_TYPE_KEYS
          The keys corresponding to TExceptionType.TYPES.
static DefaultMutableTreeNode EXECUTION_EXCEPTION_NODE
           
static DefaultMutableTreeNode EXECUTION_NODE
           
static DefaultMutableTreeNode EXECUTION_PERFORMANCE_NODE
           
static AbstractAction2[] FILE_HISTORY_ACTIONS
          The actions to load a given recently opened file.
static String[] FILE_HISTORY_KEYS
           
static int FILE_HISTORY_SIZE
           
static String[] FONT_AREA_KEYS
           
static String[] FONT_AREA_NAMES
           
static int FOREGROUND_COLOR_INDEX
           
static int HEIGHT
           
static String[] HIGHLIGHT_STYLE_KEYS
          The keys corresponding to HIGHLIGHT_STYLE_NAMES.
static String[] HIGHLIGHT_STYLE_NAMES
          A description of the syntax styles used by a TProgramDocument.
static int HIGHLIGHTED_LINE_COLOR_INDEX
           
static int HIGHLIGHTED_TEXT_COLOR_INDEX
           
static String IGNORE_WARNINGS_KEY
          The key for wheter or not to ignore warnings.
static String LAST_EDIT_HORIZONTAL_DIVIDER_LOCATION_KEY
           
static String LAST_FRAME_BOUNDS_KEY
           
static String LAST_OPTIONS_FRAME_POSITION_KEY
           
static String LAST_SIM_HORIZONTAL_DIVIDER_LOCATION_KEY
           
static String LAST_VERTICAL_DIVIDER_LOCATION_KEY
           
static int LINE_NUMBERS_COLOR_INDEX
           
static String OK_COMMAND
           
static AbstractAction2 OPTIONS_ACTION
          An action to open the options frame.
static int PROGRAM_AREA_INDEX
           
static int REFERENCE_AREA_INDEX
           
static String REFRESH_RATE_KEY
          The key for the clock periods.
static int[] REFRESH_RATES
          The possible refresh rate values.
static DefaultMutableTreeNode ROOT_NODE
           
static int SELECTED_TEXT_COLOR_INDEX
           
static int SELECTION_COLOR_INDEX
           
static int STDIN_AREA_INDEX
           
static int STDOUT_AREA_INDEX
           
static int WARNING_AREA_INDEX
           
static int WIDTH
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_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_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
 
Method Summary
 void actionPerformed(ActionEvent e)
          Implement ActionListener to pass the command onto doCommand().
 void dispose()
          Override this method to prevent unclean disposals.
 boolean doCommand(String command, Object extraInfo)
          Performs a command based on the argument.
static boolean getAutoCheck()
          Returns wheter or not the syntax should be checked automatically as the user types.
static int getClockPeriod()
          Returns the clock period (in milliseconds) that the vitrual machine should attempt to attain.
static Document getClockPeriodDocument()
          Returns a document containing a text representation of the clock period that the vitrual machine should attempt to attain.
static File getCurrentDirectory()
          Gets the directory in which JFileChoosers should start.
static TExceptionHandler getExceptionHandler()
          Gets the exception handler that all TVirtualMachines should use.
static File getFileFromHistory(int index)
          Gets a File object from the list of recent files.
static boolean getIgnoreWarnings()
          Returns wheter or not regular warnings should be ignored when the syntax of a program is being checked.
static int getLastEditHorizontalDividerLocation()
          Returns the location of the horizontal divider of the edit pane of the last TFrame which was closed.
static Rectangle getLastFrameBounds()
          Returns a copy of the bounds for the last TFrame which was closed.
static int getLastSimHorizontalDividerLocation()
          Returns the location of the horizontal divider of the sim pane of the last TFrame which was closed.
static int getLastVerticalDividerLocation()
          Returns the location of the vertical divider of the last TFrame which was closed.
static int getRefreshRate()
          Returns the refresh rate (in steps per refresh) that the TFrame should use in rendering a running toy machine.
static Document getRefreshRateDocument()
          Returns a document containing a text representation of the refresh rate that the TFrame should use in rendering a running toy machine.
protected  void processComponentEvent(ComponentEvent e)
          Intercept ComponentEvents to pick up COMPONENT_MOVED events.
protected  void processWindowEvent(WindowEvent e)
          Intercept WindowEvents to pick up WINDOW_CLOSING events.
static void putFileIntoHistory(File file)
          Puts a File object in the list of recent files.
static void registerComponent(Component comp, int areaIndex)
          Registers a component to receive font assignments for a particular area.
static void registerHighlightedTextArea(PHighlightedTextArea textArea)
          Registers a PHighlightedTextArea to receive non-font assignments (color, column markers, etc...).
static void setCurrentDirectory(File currentDirectory)
          Sets the directory in which JFileChoosers should start.
static void setLastEditHorizontalDividerLocation(int location)
          Sets the location of the horizontal divider of the edit pane of the last TFrame which was closed.
static void setLastFrameBounds(Rectangle bounds)
          Sets the bounds for the last TFrame which was closed.
static void setLastSimHorizontalDividerLocation(int location)
          Sets the location of the horizontal divider of the sim pane of the last TFrame which was closed.
static void setLastVerticalDividerLocation(int location)
          Sets the location of the vertical divider of the last TFrame which was closed.
static void show(DefaultMutableTreeNode node)
          Shows a particular pane in the TOptionsFrame.
static void unregisterComponent(Component comp, int areaIndex)
          Unregisters a component which previously received font assignments for a particular area.
static void unregisterHighlightedTextArea(PHighlightedTextArea textArea)
          Unregisters a component which previously received non-font assignments.
 void valueChanged(TreeSelectionEvent e)
          Implement TreeSelectionListener to update the cardPanel's selection when the tree's selection changes.
 
Methods inherited from class javax.swing.JFrame
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, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, 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, toFront
 
Methods inherited from class java.awt.Container
add, 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, 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, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

WIDTH

public static final int WIDTH
See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
See Also:
Constant Field Values

OK_COMMAND

public static final String OK_COMMAND

CANCEL_COMMAND

public static final String CANCEL_COMMAND

DEFAULTS_COMMAND

public static final String DEFAULTS_COMMAND

APPLY_COMMAND

public static final String APPLY_COMMAND

ROOT_NODE

public static final DefaultMutableTreeNode ROOT_NODE

EDITING_NODE

public static final DefaultMutableTreeNode EDITING_NODE

EDITING_FONTS_NODE

public static final DefaultMutableTreeNode EDITING_FONTS_NODE

EDITING_COLORS_NODE

public static final DefaultMutableTreeNode EDITING_COLORS_NODE

EDITING_HIGHLIGHTING_NODE

public static final DefaultMutableTreeNode EDITING_HIGHLIGHTING_NODE

EDITING_AUTO_COMPLETE_NODE

public static final DefaultMutableTreeNode EDITING_AUTO_COMPLETE_NODE

EDITING_CHECKING_NODE

public static final DefaultMutableTreeNode EDITING_CHECKING_NODE

EXECUTION_NODE

public static final DefaultMutableTreeNode EXECUTION_NODE

EXECUTION_EXCEPTION_NODE

public static final DefaultMutableTreeNode EXECUTION_EXCEPTION_NODE

EXECUTION_PERFORMANCE_NODE

public static final DefaultMutableTreeNode EXECUTION_PERFORMANCE_NODE

FONT_AREA_NAMES

public static final String[] FONT_AREA_NAMES

FONT_AREA_KEYS

public static final String[] FONT_AREA_KEYS

PROGRAM_AREA_INDEX

public static final int PROGRAM_AREA_INDEX
See Also:
Constant Field Values

WARNING_AREA_INDEX

public static final int WARNING_AREA_INDEX
See Also:
Constant Field Values

REFERENCE_AREA_INDEX

public static final int REFERENCE_AREA_INDEX
See Also:
Constant Field Values

STDIN_AREA_INDEX

public static final int STDIN_AREA_INDEX
See Also:
Constant Field Values

STDOUT_AREA_INDEX

public static final int STDOUT_AREA_INDEX
See Also:
Constant Field Values

CORE_AREA_INDEX

public static final int CORE_AREA_INDEX
See Also:
Constant Field Values

COLOR_NAMES

public static final String[] COLOR_NAMES

COLOR_DISABLED_DESCRIPTIONS

public static final String[] COLOR_DISABLED_DESCRIPTIONS

COLOR_COLOR_KEYS

public static final String[] COLOR_COLOR_KEYS

COLOR_DISABLED_KEYS

public static final String[] COLOR_DISABLED_KEYS

FOREGROUND_COLOR_INDEX

public static final int FOREGROUND_COLOR_INDEX
See Also:
Constant Field Values

BACKGROUND_COLOR_INDEX

public static final int BACKGROUND_COLOR_INDEX
See Also:
Constant Field Values

CARET_COLOR_INDEX

public static final int CARET_COLOR_INDEX
See Also:
Constant Field Values

SELECTION_COLOR_INDEX

public static final int SELECTION_COLOR_INDEX
See Also:
Constant Field Values

SELECTED_TEXT_COLOR_INDEX

public static final int SELECTED_TEXT_COLOR_INDEX
See Also:
Constant Field Values

HIGHLIGHTED_LINE_COLOR_INDEX

public static final int HIGHLIGHTED_LINE_COLOR_INDEX
See Also:
Constant Field Values

HIGHLIGHTED_TEXT_COLOR_INDEX

public static final int HIGHLIGHTED_TEXT_COLOR_INDEX
See Also:
Constant Field Values

LINE_NUMBERS_COLOR_INDEX

public static final int LINE_NUMBERS_COLOR_INDEX
See Also:
Constant Field Values

COLUMN_MARKERS_COLOR_INDEX

public static final int COLUMN_MARKERS_COLOR_INDEX
See Also:
Constant Field Values

HIGHLIGHT_STYLE_NAMES

public static final String[] HIGHLIGHT_STYLE_NAMES
A description of the syntax styles used by a TProgramDocument.


HIGHLIGHT_STYLE_KEYS

public static final String[] HIGHLIGHT_STYLE_KEYS
The keys corresponding to HIGHLIGHT_STYLE_NAMES.


AUTO_COMPLETERS

public static final AutoCompleter[] AUTO_COMPLETERS
A set of AutoCompleters which can be used by a PHighlightedTextArea.


AUTO_COMPLETER_NAMES

public static final String[] AUTO_COMPLETER_NAMES
The names for the AutoCompleters in the AUTO_COMPLETERS array.


AUTO_COMPLETER_KEY

public static final String AUTO_COMPLETER_KEY
The key for the autocompleter entry.

See Also:
Constant Field Values

IGNORE_WARNINGS_KEY

public static final String IGNORE_WARNINGS_KEY
The key for wheter or not to ignore warnings.

See Also:
Constant Field Values

AUTO_CHECK_KEY

public static final String AUTO_CHECK_KEY
The key for wheter or not to automatically check the user's syntax as he types.

See Also:
Constant Field Values

EXCEPTION_TYPE_KEYS

public static final String[] EXCEPTION_TYPE_KEYS
The keys corresponding to TExceptionType.TYPES.

See Also:
TExceptionType.TYPES

CLOCK_PERIOD_KEY

public static final String CLOCK_PERIOD_KEY
The key for the clock periods.

See Also:
Constant Field Values

CLOCK_PERIODS

public static final int[] CLOCK_PERIODS
The possible values for the clock periods.


REFRESH_RATE_KEY

public static final String REFRESH_RATE_KEY
The key for the clock periods.

See Also:
Constant Field Values

REFRESH_RATES

public static final int[] REFRESH_RATES
The possible refresh rate values.


OPTIONS_ACTION

public static final AbstractAction2 OPTIONS_ACTION
An action to open the options frame.


FILE_HISTORY_SIZE

public static final int FILE_HISTORY_SIZE
See Also:
Constant Field Values

FILE_HISTORY_ACTIONS

public static final AbstractAction2[] FILE_HISTORY_ACTIONS
The actions to load a given recently opened file.


FILE_HISTORY_KEYS

public static final String[] FILE_HISTORY_KEYS

CURRENT_DIRECTORY_KEY

public static final String CURRENT_DIRECTORY_KEY
See Also:
Constant Field Values

LAST_FRAME_BOUNDS_KEY

public static final String LAST_FRAME_BOUNDS_KEY
See Also:
Constant Field Values

LAST_VERTICAL_DIVIDER_LOCATION_KEY

public static final String LAST_VERTICAL_DIVIDER_LOCATION_KEY
See Also:
Constant Field Values

LAST_EDIT_HORIZONTAL_DIVIDER_LOCATION_KEY

public static final String LAST_EDIT_HORIZONTAL_DIVIDER_LOCATION_KEY
See Also:
Constant Field Values

LAST_SIM_HORIZONTAL_DIVIDER_LOCATION_KEY

public static final String LAST_SIM_HORIZONTAL_DIVIDER_LOCATION_KEY
See Also:
Constant Field Values

LAST_OPTIONS_FRAME_POSITION_KEY

public static final String LAST_OPTIONS_FRAME_POSITION_KEY
See Also:
Constant Field Values
Method Detail

dispose

public void dispose()
Override this method to prevent unclean disposals.

Overrides:
dispose in class Window

show

public static void show(DefaultMutableTreeNode node)
Shows a particular pane in the TOptionsFrame. The TOptionsFrame is made visible and brought to the front.

Parameters:
node - The node of the pane which should be shown. A null value will result in a NullPointerException.

registerComponent

public static void registerComponent(Component comp,
                                     int areaIndex)
Registers a component to receive font assignments for a particular area.

Parameters:
component - The component to register. If this is null, a NullPointerException will be thrown.
areaIndex - The index of the area for which the component will receive font assignments. If this is invalid, an ArrayIndexOutOfBoundsException will be thrown.

unregisterComponent

public static void unregisterComponent(Component comp,
                                       int areaIndex)
Unregisters a component which previously received font assignments for a particular area.

Parameters:
component - The component to unregister. If this is null, a NullPointerException will be thrown.
areaIndex - The index of the area for which the component will no longer receive font assignments. If this is invalid, an ArrayIndexOutOfBoundsException will be thrown.

registerHighlightedTextArea

public static void registerHighlightedTextArea(PHighlightedTextArea textArea)
Registers a PHighlightedTextArea to receive non-font assignments (color, column markers, etc...).

Parameters:
textArea - The text area to register. If this is null, a NullPointerException will be thrown.

unregisterHighlightedTextArea

public static void unregisterHighlightedTextArea(PHighlightedTextArea textArea)
Unregisters a component which previously received non-font assignments.

Parameters:
component - The text area to unregister. If this is null, a NullPointerException will be thrown.

getExceptionHandler

public static TExceptionHandler getExceptionHandler()
Gets the exception handler that all TVirtualMachines should use.

Returns:
The TExceptionHandler that all TVirtualMachines should use. The will-throw flags of the returned instance will be kept in-sync with the options that the user has applied.

getClockPeriod

public static int getClockPeriod()
Returns the clock period (in milliseconds) that the vitrual machine should attempt to attain.

Returns:
The clock period (in milliseconds) that the vitrual machine should attempt to attain.

getClockPeriodDocument

public static Document getClockPeriodDocument()
Returns a document containing a text representation of the clock period that the vitrual machine should attempt to attain. This TOptionsFrame will keep that document updated.

Returns:
The a document containing a text representation of the clock period that the vitrual machine should attempt to attain.

getRefreshRate

public static int getRefreshRate()
Returns the refresh rate (in steps per refresh) that the TFrame should use in rendering a running toy machine.

Returns:
The refresh rate (in steps per refresh) that the TFrame should use in rendering a running toy machine.

getRefreshRateDocument

public static Document getRefreshRateDocument()
Returns a document containing a text representation of the refresh rate that the TFrame should use in rendering a running toy machine. This TOptionsFrame will keep that document updated.

Returns:
The a document containing a text representation of the refresh rate that the TFrame should use in rendering a running toy machine.

getIgnoreWarnings

public static boolean getIgnoreWarnings()
Returns wheter or not regular warnings should be ignored when the syntax of a program is being checked.

Returns:
True iff regular warnings should be ignored when the syntax of a program is being checked.

getAutoCheck

public static boolean getAutoCheck()
Returns wheter or not the syntax should be checked automatically as the user types.

Returns:
True iff the syntax should be checked automatically as the user types.

getCurrentDirectory

public static File getCurrentDirectory()
Gets the directory in which JFileChoosers should start.

Returns:
The File object associated with the "current directory" of the program. Null is returned JFileChooser's default should be used.

setCurrentDirectory

public static void setCurrentDirectory(File currentDirectory)
Sets the directory in which JFileChoosers should start.

Parameters:
currentDirectory - The File object that should be associated with the "current directory" of the program. If null is passed, a NullPointerException will be thrown. If the File object does not correspond to an existing directory, the command will be ignored.

getFileFromHistory

public static File getFileFromHistory(int index)
Gets a File object from the list of recent files.

Parameters:
index - The index of the requested file. An invalid value will result in an ArrayIndexOutOfBoundsException.
Returns:
The file object at the given index. If no file has been specified for that index, null is returned.

putFileIntoHistory

public static void putFileIntoHistory(File file)
Puts a File object in the list of recent files. If that File object is already in the list, it will be brought to the top.

Parameters:
file - The File object that should be addedIf the File object does not correspond to a readable file, the command will be ignored.

setLastFrameBounds

public static void setLastFrameBounds(Rectangle bounds)
Sets the bounds for the last TFrame which was closed. The fields of the given Rectangle are copied over to the Rectangle maintained internally.

Parameters:
bounds - The bounds of the last TFrame which was closed.

getLastFrameBounds

public static Rectangle getLastFrameBounds()
Returns a copy of the bounds for the last TFrame which was closed.

Returns:
The bounds of the last TFrame which was closed.

setLastVerticalDividerLocation

public static void setLastVerticalDividerLocation(int location)
Sets the location of the vertical divider of the last TFrame which was closed.

Parameters:
location - The location of the vertical divider of the last TFrame which was closed.

getLastVerticalDividerLocation

public static int getLastVerticalDividerLocation()
Returns the location of the vertical divider of the last TFrame which was closed.

Returns:
The location of the vertical divider of the last TFrame which was closed.

setLastEditHorizontalDividerLocation

public static void setLastEditHorizontalDividerLocation(int location)
Sets the location of the horizontal divider of the edit pane of the last TFrame which was closed.

Parameters:
location - The location of the horizontal divider of the edit pane of the last TFrame which was closed.

getLastEditHorizontalDividerLocation

public static int getLastEditHorizontalDividerLocation()
Returns the location of the horizontal divider of the edit pane of the last TFrame which was closed.

Returns:
The location of the horizontal divider of the edit pane of the last TFrame which was closed.

setLastSimHorizontalDividerLocation

public static void setLastSimHorizontalDividerLocation(int location)
Sets the location of the horizontal divider of the sim pane of the last TFrame which was closed.

Parameters:
location - The location of the horizontal divider of the sim pane of the last TFrame which was closed.

getLastSimHorizontalDividerLocation

public static int getLastSimHorizontalDividerLocation()
Returns the location of the horizontal divider of the sim pane of the last TFrame which was closed.

Returns:
The location of the horizontal divider of the sim pane of the last TFrame which was closed.

doCommand

public boolean doCommand(String command,
                         Object extraInfo)
Performs a command based on the argument.

Parameters:
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. An IllegalArgumentException will be thrown if the argument is invalid.
Returns:
True iff the command was executed sucessfully.

actionPerformed

public void actionPerformed(ActionEvent e)
Implement ActionListener to pass the command onto doCommand().

Specified by:
actionPerformed in interface ActionListener
See Also:
doCommand(String, Object)

valueChanged

public void valueChanged(TreeSelectionEvent e)
Implement TreeSelectionListener to update the cardPanel's selection when the tree's selection changes.

Specified by:
valueChanged in interface TreeSelectionListener

processComponentEvent

protected void processComponentEvent(ComponentEvent e)
Intercept ComponentEvents to pick up COMPONENT_MOVED events.

Overrides:
processComponentEvent in class Component

processWindowEvent

protected void processWindowEvent(WindowEvent e)
Intercept WindowEvents to pick up WINDOW_CLOSING events.

Overrides:
processWindowEvent in class JFrame