Package: groovy.ui

## [Groovy] Class Console

- groovy.ui.Console

- All Implemented Interfaces and Traits:
    CaretListener, HyperlinkListener, ComponentListener, FocusListener

      class Console

  Groovy Swing console. Allows user to interactively enter and execute Groovy.

  Authors:
    Danno Ferrin
    Dierk Koenig, changed Layout, included Selection sensitivity, included ObjectBrowser
    Alan Green more features: history, System.out capture, bind result to _
    Guillaume Laforge, stacktrace hyperlinking to the current script line
    Hamlet D'Arcy, AST browser
    Roshan Dawrani
    Paul King
    Andre Steingress

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static URL` | `ICON_PATH` |
    `static URL` | `NODE_ICON_PATH` |

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `static String` | `DEFAULT_SCRIPT_NAME_START`
    `Closure` | `afterExecution`
    `boolean` | `autoClearOutput`
    `Action` | `autoClearOutputAction`
    `Closure` | `beforeExecution`
    `Component` | `blank`
    `static boolean` | `captureStdErr`
    `static boolean` | `captureStdOut`
    `int` | `colNum`
    `Style` | `commandStyle`
    `CompilerConfiguration` | `config`
    `static def` | `consoleControllers`
    `Component` | `copyFromComponent`
    `File` | `currentClasspathDir`
    `File` | `currentClasspathJarDir`
    `File` | `currentFileChooserDir`
    `int` | `cursorPos`
    `boolean` | `detachedOutput`
    `Action` | `detachedOutputAction`
    `boolean` | `dirty`
    `RootPaneContainer` | `frame`
    `static def` | `frameConsoleDelegates`
    `boolean` | `fullStackTraces`
    `Action` | `fullStackTracesAction`
    `static def` | `groovyFileFilter`
    `Action` | `hideOutputWindowAction1`
    `Action` | `hideOutputWindowAction2`
    `Action` | `hideOutputWindowAction3`
    `Action` | `hideOutputWindowAction4`
    `List` | `history`
    `int` | `historyIndex`
    `Style` | `hyperlinkStyle`
    `JTextPane` | `inputArea`
    `ConsoleTextEditor` | `inputEditor`
    `Action` | `interruptAction`
    `int` | `maxHistory`
    `int` | `maxOutputChars`
    `Action` | `nextHistoryAction`
    `int` | `origDividerSize`
    `JTextPane` | `outputArea`
    `Style` | `outputStyle`
    `Component` | `outputWindow`
    `HistoryRecord` | `pendingRecord`
    `Action` | `prevHistoryAction`
    `Style` | `promptStyle`
    `Style` | `resultStyle`
    `Element` | `rootElement`
    `int` | `rowNum`
    `JLabel` | `rowNumAndColNum`
    `Thread` | `runThread`
    `Action` | `saveAction`
    `boolean` | `saveOnRun`
    `Action` | `saveOnRunAction`
    `def` | `scriptFile`
    `int` | `scriptNameCounter`
    `boolean` | `scriptRunning`
    `Component` | `scrollArea`
    `GroovyShell` | `shell`
    `Action` | `showOutputWindowAction`
    `boolean` | `showScriptInOutput`
    `Action` | `showScriptInOutputAction`
    `boolean` | `showToolbar`
    `Action` | `showToolbarAction`
    `JSplitPane` | `splitPane`
    `boolean` | `stackOverFlowError`
    `Style` | `stacktraceStyle`
    `JLabel` | `statusLabel`
    `SwingBuilder` | `swing`
    `SystemOutputInterceptor` | `systemErrorInterceptor`
    `SystemOutputInterceptor` | `systemOutInterceptor`
    `int` | `textSelectionEnd`
    `int` | `textSelectionStart`
    `boolean` | `threadInterrupt`
    `Action` | `threadInterruptAction`
    `Component` | `toolbar`
    `boolean` | `useScriptClassLoaderForScriptExecution`
    `boolean` | `visualizeScriptResults`
    `Action` | `visualizeScriptResultsAction`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `Console ()`
    `Console (Binding binding)`
    `Console (ClassLoader parent)`
    `Console (ClassLoader parent, Binding binding)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `addClasspathDir(EventObject evt = null)`
    `` | `void` | `addClasspathJar(EventObject evt = null)`
    `` | `void` | `addToHistory(def record)`
    `` | `void` | `appendOutput(String text, AttributeSet style)`
    `` | `void` | `appendOutput(Window window, AttributeSet style)`
    `` | `void` | `appendOutput(Object object, AttributeSet style)`
    `` | `void` | `appendOutput(Component component, AttributeSet style)`
    `` | `void` | `appendOutput(Icon icon, AttributeSet style)`
    `` | `void` | `appendOutputLines(def text, def style)`
    `` | `void` | `appendOutputNl(def text, def style)`
    `` | `void` | `appendStacktrace(def text)`
    `` | `def` | `askToInterruptScript()`
    `` | `boolean` | `askToSaveFile()`
    `` | `void` | `autoClearOutput(EventObject evt)`
    `` | `void` | `beep()`
    `` | `void` | `bindResults()`
    `` | `static void` | `captureStdErr(EventObject evt)`
    `` | `static void` | `captureStdOut(EventObject evt)`
    `` | `void` | `caretUpdate(CaretEvent e)`
    `` | `void` | `clearContext(EventObject evt = null)`
    `` | `void` | `clearOutput(EventObject evt = null)`
    `` | `void` | `comment(EventObject evt = null)`
    `` | `def` | `compileFinishNormal()`
    `` | `void` | `compileScript(EventObject evt = null)`
    `` | `void` | `componentHidden(ComponentEvent e)`
    `` | `void` | `componentMoved(ComponentEvent e)`
    `` | `void` | `componentResized(ComponentEvent e)`
    `` | `void` | `componentShown(ComponentEvent e)`
    `` | `void` | `copy(EventObject evt = null)`
    `` | `void` | `cut(EventObject evt = null)`
    `` | `void` | `detachedOutput(EventObject evt)`
    `` | `void` | `doInterrupt(EventObject evt = null)`
    `` | `void` | `exit(EventObject evt = null)`
    `` | `void` | `fileNewFile(EventObject evt = null)`
    `` | `void` | `fileNewWindow(EventObject evt = null)`
    `` | `void` | `fileOpen(EventObject evt = null)`
    `` | `boolean` | `fileSave(EventObject evt = null)`
    `` | `boolean` | `fileSaveAs(EventObject evt = null)`
    `` | `void` | `find(EventObject evt = null)`
    `` | `void` | `findNext(EventObject evt = null)`
    `` | `void` | `findPrevious(EventObject evt = null)`
    `` | `def` | `finishException(Throwable t, boolean executing)`
    `` | `def` | `finishNormal(Object result)`
    `` | `void` | `focusGained(FocusEvent e)`
    `` | `void` | `focusLost(FocusEvent e)`
    `` | `void` | `fullStackTraces(EventObject evt)`
    `` | `int` | `getConsoleId()`
    `` | `def` | `getLastResult()`
    `` | `void` | `hideAndClearOutputWindow(EventObject evt = null)`
    `` | `void` | `hideOutputWindow(EventObject evt = null)`
    `` | `void` | `historyNext(EventObject evt = null)`
    `` | `void` | `historyPrev(EventObject evt = null)`
    `` | `void` | `hyperlinkUpdate(HyperlinkEvent e)`
    `` | `void` | `inspectAst(EventObject evt = null)`
    `` | `void` | `inspectLast(EventObject evt = null)`
    `` | `void` | `inspectVariables(EventObject evt = null)`
    `` | `void` | `installInterceptor()`
    `` | `void` | `invokeTextAction(def evt, def closure, def area = inputArea)`
    `` | `void` | `largerFont(EventObject evt = null)`
    `` | `void` | `loadScriptFile(File file)`
    `` | `static void` | `main(def args)`
    `` | `void` | `newScript(ClassLoader parent, Binding binding)`
    `` | `static boolean` | `notifySystemErr(int consoleId, String str)`
    `` | `static boolean` | `notifySystemOut(int consoleId, String str)`
    `` | `void` | `paste(EventObject evt = null)`
    `` | `void` | `print(EventObject evt = null)`
    `` | `void` | `redo(EventObject evt = null)`
    `` | `void` | `replace(EventObject evt = null)`
    `` | `void` | `run()`
    `` | `void` | `run(JApplet applet)`
    `` | `void` | `run(Map defaults)`
    `` | `void` | `runScript(EventObject evt = null)`
    `` | `void` | `runSelectedScript(EventObject evt = null)`
    `` | `void` | `saveOnRun(EventObject evt = null)`
    `` | `void` | `selectAll(EventObject evt = null)`
    `` | `def` | `selectFilename(def name = 'Open')`
    `` | `void` | `setDirty(boolean newDirty)`
    `` | `void` | `setRowNumAndColNum()`
    `` | `void` | `setVariable(String name, Object value)`
    `` | `void` | `showAbout(EventObject evt = null)`
    `` | `void` | `showCompilingMessage()`
    `` | `void` | `showExecutingMessage()`
    `` | `void` | `showMessage(String message)`
    `` | `void` | `showOutputWindow(EventObject evt = null)`
    `` | `void` | `showScriptInOutput(EventObject evt)`
    `` | `void` | `showToolbar(EventObject evt)`
    `` | `void` | `smallerFont(EventObject evt = null)`
    `` | `void` | `threadInterruption(EventObject evt)`
    `` | `void` | `undo(EventObject evt = null)`
    `` | `void` | `updateTitle()`
    `` | `void` | `visualizeScriptResults(EventObject evt)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static URL ICON_PATH

    - #### public static URL NODE_ICON_PATH

  - ### Property Detail

    - #### static final String DEFAULT_SCRIPT_NAME_START

    - #### Closure afterExecution

    - #### boolean autoClearOutput

    - #### Action autoClearOutputAction

    - #### Closure beforeExecution

    - #### Component blank

    - #### static boolean captureStdErr

    - #### static boolean captureStdOut

    - #### int colNum

    - #### Style commandStyle

    - #### CompilerConfiguration config

    - #### static def consoleControllers

    - #### Component copyFromComponent

    - #### File currentClasspathDir

    - #### File currentClasspathJarDir

    - #### File currentFileChooserDir

    - #### int cursorPos

    - #### boolean detachedOutput

    - #### Action detachedOutputAction

    - #### boolean dirty

    - #### RootPaneContainer frame

    - #### static def frameConsoleDelegates

    - #### boolean fullStackTraces

    - #### Action fullStackTracesAction

    - #### static def groovyFileFilter

    - #### Action hideOutputWindowAction1

    - #### Action hideOutputWindowAction2

    - #### Action hideOutputWindowAction3

    - #### Action hideOutputWindowAction4

    - #### List history

    - #### int historyIndex

    - #### Style hyperlinkStyle

    - #### JTextPane inputArea

    - #### ConsoleTextEditor inputEditor

    - #### Action interruptAction

    - #### int maxHistory

    - #### int maxOutputChars

    - #### Action nextHistoryAction

    - #### int origDividerSize

    - #### JTextPane outputArea

    - #### Style outputStyle

    - #### Component outputWindow

    - #### HistoryRecord pendingRecord

    - #### Action prevHistoryAction

    - #### Style promptStyle

    - #### Style resultStyle

    - #### Element rootElement

    - #### int rowNum

    - #### JLabel rowNumAndColNum

    - #### Thread runThread

    - #### Action saveAction

    - #### boolean saveOnRun

    - #### Action saveOnRunAction

    - #### def scriptFile

    - #### int scriptNameCounter

    - #### boolean scriptRunning

    - #### Component scrollArea

    - #### GroovyShell shell

    - #### Action showOutputWindowAction

    - #### boolean showScriptInOutput

    - #### Action showScriptInOutputAction

    - #### boolean showToolbar

    - #### Action showToolbarAction

    - #### JSplitPane splitPane

    - #### boolean stackOverFlowError

    - #### Style stacktraceStyle

    - #### JLabel statusLabel

    - #### SwingBuilder swing

    - #### SystemOutputInterceptor systemErrorInterceptor

    - #### SystemOutputInterceptor systemOutInterceptor

    - #### int textSelectionEnd

    - #### int textSelectionStart

    - #### boolean threadInterrupt

    - #### Action threadInterruptAction

    - #### Component toolbar

    - #### boolean useScriptClassLoaderForScriptExecution

    - #### boolean visualizeScriptResults

    - #### Action visualizeScriptResultsAction

  - ### Constructor Detail

    - #### Console()

    - #### Console(Binding binding)

    - #### Console(ClassLoader parent)

    - #### Console(ClassLoader parent, Binding binding)

  - ### Method Detail

    - #### void addClasspathDir(EventObject evt = null)

    - #### void addClasspathJar(EventObject evt = null)

    - #### void addToHistory(def record)

    - #### void appendOutput(String text, AttributeSet style)

    - #### void appendOutput(Window window, AttributeSet style)

    - #### void appendOutput(Object object, AttributeSet style)

    - #### void appendOutput(Component component, AttributeSet style)

    - #### void appendOutput(Icon icon, AttributeSet style)

    - #### void appendOutputLines(def text, def style)

    - #### void appendOutputNl(def text, def style)

    - #### void appendStacktrace(def text)

    - #### def askToInterruptScript()

    - #### boolean askToSaveFile()

    - #### void autoClearOutput(EventObject evt)

    - #### void beep()

    - #### void bindResults()

    - #### static void captureStdErr(EventObject evt)

    - #### static void captureStdOut(EventObject evt)

    - #### void caretUpdate(CaretEvent e)

    - #### void clearContext(EventObject evt = null)

    - #### void clearOutput(EventObject evt = null)

    - #### void comment(EventObject evt = null)

    - #### def compileFinishNormal()

    - #### void compileScript(EventObject evt = null)

    - #### void componentHidden(ComponentEvent e)

    - #### void componentMoved(ComponentEvent e)

    - #### void componentResized(ComponentEvent e)

    - #### void componentShown(ComponentEvent e)

    - #### void copy(EventObject evt = null)

    - #### void cut(EventObject evt = null)

    - #### void detachedOutput(EventObject evt)

    - #### void doInterrupt(EventObject evt = null)

    - #### void exit(EventObject evt = null)

    - #### void fileNewFile(EventObject evt = null)

    - #### void fileNewWindow(EventObject evt = null)

    - #### void fileOpen(EventObject evt = null)

    - #### boolean fileSave(EventObject evt = null)

    - #### boolean fileSaveAs(EventObject evt = null)

    - #### void find(EventObject evt = null)

    - #### void findNext(EventObject evt = null)

    - #### void findPrevious(EventObject evt = null)

    - #### def finishException(Throwable t, boolean executing)

    - #### def finishNormal(Object result)

    - #### void focusGained(FocusEvent e)

    - #### void focusLost(FocusEvent e)

    - #### void fullStackTraces(EventObject evt)

    - #### int getConsoleId()

    - #### def getLastResult()

    - #### void hideAndClearOutputWindow(EventObject evt = null)

    - #### void hideOutputWindow(EventObject evt = null)

    - #### void historyNext(EventObject evt = null)

    - #### void historyPrev(EventObject evt = null)

    - #### void hyperlinkUpdate(HyperlinkEvent e)

    - #### void inspectAst(EventObject evt = null)

    - #### void inspectLast(EventObject evt = null)

    - #### void inspectVariables(EventObject evt = null)

    - #### void installInterceptor()

    - #### void invokeTextAction(def evt, def closure, def area = inputArea)

    - #### void largerFont(EventObject evt = null)

    - #### void loadScriptFile(File file)

    - #### static void main(def args)

    - #### void newScript(ClassLoader parent, Binding binding)

    - #### static boolean notifySystemErr(int consoleId, String str)

    - #### static boolean notifySystemOut(int consoleId, String str)

    - #### void paste(EventObject evt = null)

    - #### void print(EventObject evt = null)

    - #### void redo(EventObject evt = null)

    - #### void replace(EventObject evt = null)

    - #### void run()

    - #### void run(JApplet applet)

    - #### void run(Map defaults)

    - #### void runScript(EventObject evt = null)

    - #### void runSelectedScript(EventObject evt = null)

    - #### void saveOnRun(EventObject evt = null)

    - #### void selectAll(EventObject evt = null)

    - #### def selectFilename(def name = 'Open')

    - #### void setDirty(boolean newDirty)

    - #### void setRowNumAndColNum()

    - #### void setVariable(String name, Object value)

    - #### void showAbout(EventObject evt = null)

    - #### void showCompilingMessage()

    - #### void showExecutingMessage()

    - #### void showMessage(String message)

    - #### void showOutputWindow(EventObject evt = null)

    - #### void showScriptInOutput(EventObject evt)

    - #### void showToolbar(EventObject evt)

    - #### void smallerFont(EventObject evt = null)

    - #### void threadInterruption(EventObject evt)

    - #### void undo(EventObject evt = null)

    - #### void updateTitle()

    - #### void visualizeScriptResults(EventObject evt)