edu.princeton.toy
public class TOptionsFrame extends javax.swing.JFrame implements java.awt.event.ActionListener, javax.swing.event.TreeSelectionListener
Modifier and Type | Class and Description |
---|---|
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.
|
javax.swing.JFrame.AccessibleJFrame
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLY_COMMAND |
static java.lang.String |
AUTO_CHECK_KEY
The key for wheter or not to automatically check the user's syntax as he types.
|
static java.lang.String |
AUTO_COMPLETER_KEY
The key for the autocompleter entry.
|
static AutoCompleter[] |
AUTO_COMPLETERS
A set of AutoCompleters which can be used by a PHighlightedTextArea.
|
static int |
BACKGROUND_COLOR_INDEX |
static java.lang.String |
CANCEL_COMMAND |
static int |
CARET_COLOR_INDEX |
static java.lang.String |
CLOCK_PERIOD_KEY
The key for the clock periods.
|
static int[] |
CLOCK_PERIODS
The possible values for the clock periods.
|
static java.lang.String[] |
COLOR_COLOR_KEYS |
static java.lang.String[] |
COLOR_DISABLED_DESCRIPTIONS |
static java.lang.String[] |
COLOR_DISABLED_KEYS |
static java.lang.String[] |
COLOR_NAMES |
static int |
COLUMN_MARKERS_COLOR_INDEX |
static int |
CORE_AREA_INDEX |
static java.lang.String |
CURRENT_DIRECTORY_KEY |
static java.lang.String |
DEFAULTS_COMMAND |
static javax.swing.tree.DefaultMutableTreeNode |
EDITING_CHECKING_NODE |
static javax.swing.tree.DefaultMutableTreeNode |
EDITING_COLORS_NODE |
static javax.swing.tree.DefaultMutableTreeNode |
EDITING_FONTS_NODE |
static javax.swing.tree.DefaultMutableTreeNode |
EDITING_HIGHLIGHTING_NODE |
static javax.swing.tree.DefaultMutableTreeNode |
EDITING_NODE |
static java.lang.String[] |
EXCEPTION_TYPE_KEYS
The keys corresponding to TExceptionType.TYPES.
|
static javax.swing.tree.DefaultMutableTreeNode |
EXECUTION_EXCEPTION_NODE |
static javax.swing.tree.DefaultMutableTreeNode |
EXECUTION_NODE |
static javax.swing.tree.DefaultMutableTreeNode |
EXECUTION_PERFORMANCE_NODE |
static AbstractAction2[] |
FILE_HISTORY_ACTIONS
The actions to load a given recently opened file.
|
static java.lang.String[] |
FILE_HISTORY_KEYS |
static int |
FILE_HISTORY_SIZE |
static java.lang.String[] |
FONT_AREA_KEYS |
static java.lang.String[] |
FONT_AREA_NAMES |
static int |
FOREGROUND_COLOR_INDEX |
static int |
HEIGHT |
static java.lang.String[] |
HIGHLIGHT_STYLE_KEYS
The keys corresponding to HIGHLIGHT_STYLE_NAMES.
|
static java.lang.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 java.lang.String |
IGNORE_WARNINGS_KEY
The key for wheter or not to ignore warnings.
|
static java.lang.String |
LAST_EDIT_HORIZONTAL_DIVIDER_LOCATION_KEY |
static java.lang.String |
LAST_FRAME_BOUNDS_KEY |
static java.lang.String |
LAST_OPTIONS_FRAME_POSITION_KEY |
static java.lang.String |
LAST_SIM_HORIZONTAL_DIVIDER_LOCATION_KEY |
static java.lang.String |
LAST_VERTICAL_DIVIDER_LOCATION_KEY |
static int |
LINE_NUMBERS_COLOR_INDEX |
static java.lang.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 java.lang.String |
REFRESH_RATE_KEY
The key for the clock periods.
|
static int[] |
REFRESH_RATES
The possible refresh rate values.
|
static javax.swing.tree.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 |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Implement ActionListener to pass the command onto doCommand().
|
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.
|
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 javax.swing.text.Document |
getClockPeriodDocument()
Returns a document containing a text representation of the clock period that the vitrual
machine should attempt to attain.
|
static java.io.File |
getCurrentDirectory()
Gets the directory in which JFileChoosers should start.
|
static TExceptionHandler |
getExceptionHandler()
Gets the exception handler that all TVirtualMachines should use.
|
static java.io.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 java.awt.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 javax.swing.text.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(java.awt.event.ComponentEvent e)
Intercept ComponentEvents to pick up COMPONENT_MOVED events.
|
protected void |
processWindowEvent(java.awt.event.WindowEvent e)
Intercept WindowEvents to pick up WINDOW_CLOSING events.
|
static void |
putFileIntoHistory(java.io.File file)
Puts a File object in the list of recent files.
|
static void |
registerComponent(java.awt.Component component,
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(java.io.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(java.awt.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(javax.swing.tree.DefaultMutableTreeNode node)
Shows a particular pane in the TOptionsFrame.
|
static void |
unregisterComponent(java.awt.Component component,
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(javax.swing.event.TreeSelectionEvent e)
Implement TreeSelectionListener to update the cardPanel's selection when the tree'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, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
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
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, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, 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, transferFocusBackward, transferFocusUpCycle
public static final int WIDTH
public static final int HEIGHT
public static final java.lang.String OK_COMMAND
public static final java.lang.String CANCEL_COMMAND
public static final java.lang.String DEFAULTS_COMMAND
public static final java.lang.String APPLY_COMMAND
public static final javax.swing.tree.DefaultMutableTreeNode ROOT_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EDITING_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EDITING_FONTS_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EDITING_COLORS_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EDITING_HIGHLIGHTING_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EDITING_CHECKING_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EXECUTION_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EXECUTION_EXCEPTION_NODE
public static final javax.swing.tree.DefaultMutableTreeNode EXECUTION_PERFORMANCE_NODE
public static final java.lang.String[] FONT_AREA_NAMES
public static final java.lang.String[] FONT_AREA_KEYS
public static final int PROGRAM_AREA_INDEX
public static final int WARNING_AREA_INDEX
public static final int REFERENCE_AREA_INDEX
public static final int STDIN_AREA_INDEX
public static final int STDOUT_AREA_INDEX
public static final int CORE_AREA_INDEX
public static final java.lang.String[] COLOR_NAMES
public static final java.lang.String[] COLOR_DISABLED_DESCRIPTIONS
public static final java.lang.String[] COLOR_COLOR_KEYS
public static final java.lang.String[] COLOR_DISABLED_KEYS
public static final int FOREGROUND_COLOR_INDEX
public static final int BACKGROUND_COLOR_INDEX
public static final int CARET_COLOR_INDEX
public static final int SELECTION_COLOR_INDEX
public static final int SELECTED_TEXT_COLOR_INDEX
public static final int HIGHLIGHTED_LINE_COLOR_INDEX
public static final int HIGHLIGHTED_TEXT_COLOR_INDEX
public static final int LINE_NUMBERS_COLOR_INDEX
public static final int COLUMN_MARKERS_COLOR_INDEX
public static final java.lang.String[] HIGHLIGHT_STYLE_NAMES
public static final java.lang.String[] HIGHLIGHT_STYLE_KEYS
public static final AutoCompleter[] AUTO_COMPLETERS
public static final java.lang.String AUTO_COMPLETER_KEY
public static final java.lang.String IGNORE_WARNINGS_KEY
public static final java.lang.String AUTO_CHECK_KEY
public static final java.lang.String[] EXCEPTION_TYPE_KEYS
TExceptionType.TYPES
public static final java.lang.String CLOCK_PERIOD_KEY
public static final int[] CLOCK_PERIODS
public static final java.lang.String REFRESH_RATE_KEY
public static final int[] REFRESH_RATES
public static final AbstractAction2 OPTIONS_ACTION
public static final int FILE_HISTORY_SIZE
public static final AbstractAction2[] FILE_HISTORY_ACTIONS
public static final java.lang.String[] FILE_HISTORY_KEYS
public static final java.lang.String CURRENT_DIRECTORY_KEY
public static final java.lang.String LAST_FRAME_BOUNDS_KEY
public static final java.lang.String LAST_VERTICAL_DIVIDER_LOCATION_KEY
public static final java.lang.String LAST_EDIT_HORIZONTAL_DIVIDER_LOCATION_KEY
public static final java.lang.String LAST_SIM_HORIZONTAL_DIVIDER_LOCATION_KEY
public static final java.lang.String LAST_OPTIONS_FRAME_POSITION_KEY
public void dispose()
dispose
in class java.awt.Window
public static void show(javax.swing.tree.DefaultMutableTreeNode node)
node
- The node of the pane which should be shown. A null value will result in a
NullPointerException.public static void registerComponent(java.awt.Component component, int areaIndex)
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.public static void unregisterComponent(java.awt.Component component, int areaIndex)
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.public static void registerHighlightedTextArea(PHighlightedTextArea textArea)
textArea
- The text area to register. If this is null, a NullPointerException will
be thrown.public static void unregisterHighlightedTextArea(PHighlightedTextArea textArea)
textArea
- The text area to unregister. If this is null, a NullPointerException will
be thrown.public static TExceptionHandler getExceptionHandler()
public static int getClockPeriod()
public static javax.swing.text.Document getClockPeriodDocument()
public static int getRefreshRate()
public static javax.swing.text.Document getRefreshRateDocument()
public static boolean getIgnoreWarnings()
public static boolean getAutoCheck()
public static java.io.File getCurrentDirectory()
public static void setCurrentDirectory(java.io.File currentDirectory)
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.public static java.io.File getFileFromHistory(int index)
index
- The index of the requested file. An invalid value will result in an
ArrayIndexOutOfBoundsException.public static void putFileIntoHistory(java.io.File file)
file
- The File object that should be addedIf the File object does not correspond to
a readable file, the command will be ignored.public static void setLastFrameBounds(java.awt.Rectangle bounds)
bounds
- The bounds of the last TFrame which was closed.public static java.awt.Rectangle getLastFrameBounds()
public static void setLastVerticalDividerLocation(int location)
location
- The location of the vertical divider of the last TFrame which was closed.public static int getLastVerticalDividerLocation()
public static void setLastEditHorizontalDividerLocation(int location)
location
- The location of the horizontal divider of the edit pane of the last TFrame
which was closed.public static int getLastEditHorizontalDividerLocation()
public static void setLastSimHorizontalDividerLocation(int location)
location
- The location of the horizontal divider of the sim pane of the last TFrame
which was closed.public static int getLastSimHorizontalDividerLocation()
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. An IllegalArgumentException will be thrown if the argument is invalid.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
doCommand(String, Object)
public void valueChanged(javax.swing.event.TreeSelectionEvent e)
valueChanged
in interface javax.swing.event.TreeSelectionListener
protected void processComponentEvent(java.awt.event.ComponentEvent e)
processComponentEvent
in class java.awt.Component
protected void processWindowEvent(java.awt.event.WindowEvent e)
processWindowEvent
in class javax.swing.JFrame