public abstract class AbstractConsoleProgram extends Program
JApplet.AccessibleJApplet
Applet.AccessibleApplet
Panel.AccessibleAWTPanel
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected static String |
PROGRAM_COMPLETED_TITLE_SUFFIX |
CONFIG_FILE_NAME, invisibleObjects
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
AbstractConsoleProgram() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkCompilerFlags() |
void |
clearConsole()
Erases any text from the main console.
|
protected void |
compareOutput()
Pops up a file chooser to compare output to some expected output.
|
protected void |
endHook()
Called as the program is shutting down.
|
void |
fontEnlarge()
Makes the console's font larger by 2pt.
|
void |
fontShrink()
Makes the console's font smaller by 2pt.
|
void |
fontToggleBold()
Makes the console's font toggle between bold and non-bold.
|
String |
getAllOutput()
Returns all text that has been displayed on this console so far.
|
Font |
getFont()
Returns the font currently used in the console.
|
void |
historyDown()
Retrieves the next command in the console input history.
|
void |
historyUp()
Retrieves the previous command in the console input history.
|
protected void |
loadConfiguration(Properties props)
Reads the console's configuration settings, if present.
|
protected void |
loadInputScript()
Pops up a file chooser to compare output to some expected output.
|
boolean |
menuAction(ActionEvent event)
Responds to menu clicks.
|
void |
mouseWheelMoved(MouseWheelEvent e)
Implementation of MouseWheelListener interface.
|
String |
promptUserForFile(String prompt)
Asks the user to type a file name, re-prompting until the user types a
file that exists in the current directory.
|
String |
promptUserForFile(String prompt,
String directory)
Asks the user to type a file name, re-prompting until the user types a
file that exists in the given directory.
|
String |
promptUserForFile(String prompt,
String directory,
String reprompt)
Asks the user to type a file name, re-prompting until the user types a
file that exists in the given directory.
|
protected void |
saveConfiguration(Properties props)
Writes the console's configuration settings to disk.
|
void |
scrollLineDown()
Tells the console's output area to scroll itself downward by one line.
|
void |
scrollLineUp()
Tells the console's output area to scroll itself upward by one line.
|
void |
scrollPageDown()
Tells the console's output area to scroll itself downward by one page.
|
void |
scrollPageUp()
Tells the console's output area to scroll itself upward by one page.
|
void |
scrollToBottom()
Tells the console's output area to scroll itself to the bottom of the output.
|
void |
scrollToTop()
Tells the console's output area to scroll itself to the top of the output.
|
void |
setClearConsoleEnabled(boolean enabled)
Turns on/off the ability to clear the console using clearConsole(); (default true)
|
protected void |
setColorFromChooser(boolean background)
Pops up a JColorChooser to let the user pick a color for the console.
|
void |
setFont(Font font)
Sets the font for the console.
|
void |
setFont(String str)
Sets the font used for the console as specified by the string
str , which is interpreted in the style of
Font.decode . |
protected void |
setFontFromChooser()
Pops up a JFontChooser to let the user pick a font for the console.
|
actionPerformed, add, addActionListeners, addActionListeners, addActionListenersToButtonsOnly, addAllActionListeners, addExitHook, addImpl, adjustmentValueChanged, alert, alert, animation, center, changedUpdate, checkKill, checkStartupSettings, componentAdded, componentHidden, componentMoved, componentRemoved, componentResized, componentShown, confirm, contentsChanged, createConsole, createDialogIO, createMenuBar, createParameterTable, createProgramFrame, destroy, error, error, error, exit, fileExists, fileExists, fileExistsInsideJAR, fileExistsInsideJAR, fileExistsOnDisk, fileExistsOnDisk, fileSize, fileSize, focusGained, focusLost, getAnimationDelay, getAppletStub, getArgumentArray, getBoolean, getBoolean, getBoolean, getBorder, getBottomY, getCenterLocation, getCenterX, getCenterY, getCentralRegionSize, getConsole, getDialog, getDouble, getDouble, getDouble, getDouble, getHeight, getInputModel, getInteger, getInteger, getInteger, getInteger, getJFrame, getLayout, getLine, getLine, getMainThread, getMenuBar, getOutputColor, getOutputModel, getParameter, getParameterTable, getPreferredSize, getReader, getReal, getReal, getReal, getReal, getRegionPanel, getRightX, getScreenHeight, getScreenSize, getScreenWidth, getStartupObject, getTitle, getWidth, getWindow, getWriter, getYesOrNo, hasConfiguration, init, insertUpdate, intervalAdded, intervalRemoved, isAnimated, isApplet, isAppletMode, isExitOnClose, isInitialized, isStarted, itemStateChanged, keyPressed, keyReleased, keyTyped, killMe, loadConfiguration, main, menuCanceled, menuDeselected, menuSelected, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, openFile, openFile, openFileFromDisk, openFileFromDisk, openFileFromJAR, openFileFromJAR, pack, pause, pauseTick, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, printf, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, prompt, readBoolean, readBoolean, readBoolean, readDouble, readDouble, readDouble, readDouble, readInt, readInt, readInt, readInt, readLine, readLine, remove, remove, removeAll, removeFromRegion, removeMenuBar, removeUpdate, repaint, run, runHook, saveConfiguration, setAnimated, setAnimationDelay, setAppletStub, setBackground, setBottomY, setCenterLocation, setCenterX, setCenterY, setConsole, setDialog, setExitOnClose, setFramesPerSecond, setHeight, setInputModel, setInvisible, setJFrame, setJMenuBar, setLayout, setLocation, setLocation, setOutputColor, setOutputModel, setParameter, setParameterTable, setPauseScaleFactor, setResizable, setRightX, setShowPixelGrid, setShowPixelInfo, setSize, setStartupObject, setTitle, setWidth, setX, setY, showErrorMessage, start, start, startAnimation, startHook, startRun, stateChanged, stopAnimation, textValueChanged, validate, valueChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, repaint, setContentPane, setGlassPane, setLayeredPane, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, 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, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected static final String PROGRAM_COMPLETED_TITLE_SUFFIX
protected void checkCompilerFlags()
checkCompilerFlags
in class Program
public void clearConsole()
protected void compareOutput()
protected void endHook()
protected void loadInputScript()
public void fontEnlarge()
public void fontShrink()
public void fontToggleBold()
public String getAllOutput()
public Font getFont()
getFont
in interface MenuContainer
getFont
in class Component
public void historyDown()
public void historyUp()
protected void loadConfiguration(Properties props)
loadConfiguration
in class Program
props
- properties to load frompublic boolean menuAction(ActionEvent event)
menuAction
in class Program
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
mouseWheelMoved
in class Program
public String promptUserForFile(String prompt)
prompt
- the text to display to the userdirectory
- the working directory in which to look for files (e.g. "res/")public String promptUserForFile(String prompt, String directory)
prompt
- the text to display to the userdirectory
- the working directory in which to look for files (e.g. "res/")public String promptUserForFile(String prompt, String directory, String reprompt)
prompt
- the text to display to the userdirectory
- the working directory in which to look for files (e.g. "res/")public void setClearConsoleEnabled(boolean enabled)
enabled
- Whether to enable clearConsole();protected void saveConfiguration(Properties props)
saveConfiguration
in class Program
public void scrollLineDown()
public void scrollLineUp()
public void scrollPageDown()
public void scrollPageUp()
public void scrollToTop()
public void scrollToBottom()
protected void setColorFromChooser(boolean background)
public void setFont(Font font)
public void setFont(String str)
str
, which is interpreted in the style of
Font.decode
. The usual format of the font string is
family-
style-
size
where both style and size are optional. If any of these parts are specified as an asterisk, the existing value is retained.
str
- A String
specifying the new fontprotected void setFontFromChooser()