Groovy Documentation

## groovy.ui
[Groovy] Class Console

    java.lang.Object
      groovy.ui.Console

All Implemented Interfaces:
  javax.swing.event.CaretListener, javax.swing.event.HyperlinkListener, java.awt.event.ComponentListener, java.awt.event.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

Version:
  \$Id\$

Field Summary
`static java.net.URL` | `ICON_PATH`
`static java.net.URL` | `NODE_ICON_PATH`

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

Constructor Summary
`Console()`
`Console(Binding binding)`
`Console(java.lang.ClassLoader parent)`
`Console(java.lang.ClassLoader parent, Binding binding)`

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

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### ICON_PATH

    public static java.net.URL ICON_PATH

### NODE_ICON_PATH

    public static java.net.URL NODE_ICON_PATH

Property Detail

### DEFAULT_SCRIPT_NAME_START

    static final java.lang.String DEFAULT_SCRIPT_NAME_START

### afterExecution

    Closure afterExecution

### autoClearOutput

    boolean autoClearOutput

### autoClearOutputAction

    javax.swing.Action autoClearOutputAction

### beforeExecution

    Closure beforeExecution

### blank

    java.awt.Component blank

### captureStdErr

    static boolean captureStdErr

### captureStdOut

    static boolean captureStdOut

### colNum

    int colNum

### commandStyle

    javax.swing.text.Style commandStyle

### config

    CompilerConfiguration config

### consoleControllers

    static java.lang.Object consoleControllers

### copyFromComponent

    java.awt.Component copyFromComponent

### currentClasspathDir

    java.io.File currentClasspathDir

### currentClasspathJarDir

    java.io.File currentClasspathJarDir

### currentFileChooserDir

    java.io.File currentFileChooserDir

### cursorPos

    int cursorPos

### detachedOutput

    boolean detachedOutput

### detachedOutputAction

    javax.swing.Action detachedOutputAction

### dirty

    boolean dirty

### frame

    javax.swing.RootPaneContainer frame

### frameConsoleDelegates

    static java.lang.Object frameConsoleDelegates

### fullStackTraces

    boolean fullStackTraces

### fullStackTracesAction

    javax.swing.Action fullStackTracesAction

### hideOutputWindowAction1

    javax.swing.Action hideOutputWindowAction1

### hideOutputWindowAction2

    javax.swing.Action hideOutputWindowAction2

### hideOutputWindowAction3

    javax.swing.Action hideOutputWindowAction3

### hideOutputWindowAction4

    javax.swing.Action hideOutputWindowAction4

### history

    java.util.List history

### historyIndex

    int historyIndex

### hyperlinkStyle

    javax.swing.text.Style hyperlinkStyle

### inputArea

    javax.swing.JTextPane inputArea

### inputEditor

    ConsoleTextEditor inputEditor

### interruptAction

    javax.swing.Action interruptAction

### maxHistory

    int maxHistory

### maxOutputChars

    int maxOutputChars

### nextHistoryAction

    javax.swing.Action nextHistoryAction

### origDividerSize

    int origDividerSize

### outputArea

    javax.swing.JTextPane outputArea

### outputStyle

    javax.swing.text.Style outputStyle

### outputWindow

    java.awt.Component outputWindow

### pendingRecord

    HistoryRecord pendingRecord

### prevHistoryAction

    javax.swing.Action prevHistoryAction

### promptStyle

    javax.swing.text.Style promptStyle

### resultStyle

    javax.swing.text.Style resultStyle

### rootElement

    javax.swing.text.Element rootElement

### rowNum

    int rowNum

### rowNumAndColNum

    javax.swing.JLabel rowNumAndColNum

### runThread

    java.lang.Thread runThread

### saveAction

    javax.swing.Action saveAction

### scriptFile

    java.lang.Object scriptFile

### scriptNameCounter

    int scriptNameCounter

### scrollArea

    java.awt.Component scrollArea

### shell

    GroovyShell shell

### showOutputWindowAction

    javax.swing.Action showOutputWindowAction

### showScriptInOutput

    boolean showScriptInOutput

### showScriptInOutputAction

    javax.swing.Action showScriptInOutputAction

### showToolbar

    boolean showToolbar

### showToolbarAction

    javax.swing.Action showToolbarAction

### splitPane

    javax.swing.JSplitPane splitPane

### stacktraceStyle

    javax.swing.text.Style stacktraceStyle

### statusLabel

    javax.swing.JLabel statusLabel

### swing

    SwingBuilder swing

### systemErrorInterceptor

    SystemOutputInterceptor systemErrorInterceptor

### systemOutInterceptor

    SystemOutputInterceptor systemOutInterceptor

### textSelectionEnd

    int textSelectionEnd

### textSelectionStart

    int textSelectionStart

### threadInterrupt

    boolean threadInterrupt

### threadInterruptAction

    javax.swing.Action threadInterruptAction

### toolbar

    java.awt.Component toolbar

### visualizeScriptResults

    boolean visualizeScriptResults

### visualizeScriptResultsAction

    javax.swing.Action visualizeScriptResultsAction

Constructor Detail

### Console

    Console()

### Console

    Console(Binding binding)

### Console

    Console(java.lang.ClassLoader parent)

### Console

    Console(java.lang.ClassLoader parent, Binding binding)

Method Detail

### addClasspathDir

    void addClasspathDir(java.util.EventObject evt = null)

### addClasspathJar

    void addClasspathJar(java.util.EventObject evt = null)

### addToHistory

    void addToHistory(java.lang.Object record)

### appendOutput

    void appendOutput(java.lang.String text, javax.swing.text.AttributeSet style)

### appendOutput

    void appendOutput(java.awt.Window window, javax.swing.text.AttributeSet style)

### appendOutput

    void appendOutput(java.lang.Object object, javax.swing.text.AttributeSet style)

### appendOutput

    void appendOutput(java.awt.Component component, javax.swing.text.AttributeSet style)

### appendOutput

    void appendOutput(javax.swing.Icon icon, javax.swing.text.AttributeSet style)

### appendOutputLines

    void appendOutputLines(java.lang.Object text, java.lang.Object style)

### appendOutputNl

    void appendOutputNl(java.lang.Object text, java.lang.Object style)

### appendStacktrace

    void appendStacktrace(java.lang.Object text)

### askToInterruptScript

    java.lang.Object askToInterruptScript()

### askToSaveFile

    boolean askToSaveFile()

### autoClearOutput

    void autoClearOutput(java.util.EventObject evt)

### beep

    void beep()

### bindResults

    void bindResults()

### captureStdErr

    static void captureStdErr(java.util.EventObject evt)

### captureStdOut

    static void captureStdOut(java.util.EventObject evt)

### caretUpdate

    void caretUpdate(javax.swing.event.CaretEvent e)

### clearContext

    void clearContext(java.util.EventObject evt = null)

### clearOutput

    void clearOutput(java.util.EventObject evt = null)

### compileFinishNormal

    java.lang.Object compileFinishNormal()

### compileScript

    void compileScript(java.util.EventObject evt = null)

### componentHidden

    void componentHidden(java.awt.event.ComponentEvent e)

### componentMoved

    void componentMoved(java.awt.event.ComponentEvent e)

### componentResized

    void componentResized(java.awt.event.ComponentEvent e)

### componentShown

    void componentShown(java.awt.event.ComponentEvent e)

### copy

    void copy(java.util.EventObject evt = null)

### cut

    void cut(java.util.EventObject evt = null)

### detachedOutput

    void detachedOutput(java.util.EventObject evt)

### doInterrupt

    void doInterrupt(java.util.EventObject evt = null)

### exit

    void exit(java.util.EventObject evt = null)

### fileNewFile

    void fileNewFile(java.util.EventObject evt = null)

### fileNewWindow

    void fileNewWindow(java.util.EventObject evt = null)

### fileOpen

    void fileOpen(java.util.EventObject evt = null)

### fileSave

    boolean fileSave(java.util.EventObject evt = null)

### fileSaveAs

    boolean fileSaveAs(java.util.EventObject evt = null)

### find

    void find(java.util.EventObject evt = null)

### findNext

    void findNext(java.util.EventObject evt = null)

### findPrevious

    void findPrevious(java.util.EventObject evt = null)

### finishException

    java.lang.Object finishException(java.lang.Throwable t, boolean executing)

### finishNormal

    java.lang.Object finishNormal(java.lang.Object result)

### focusGained

    void focusGained(java.awt.event.FocusEvent e)

### focusLost

    void focusLost(java.awt.event.FocusEvent e)

### fullStackTraces

    void fullStackTraces(java.util.EventObject evt)

### getLastResult

    java.lang.Object getLastResult()

### hideAndClearOutputWindow

    void hideAndClearOutputWindow(java.util.EventObject evt = null)

### hideOutputWindow

    void hideOutputWindow(java.util.EventObject evt = null)

### historyNext

    void historyNext(java.util.EventObject evt = null)

### historyPrev

    void historyPrev(java.util.EventObject evt = null)

### hyperlinkUpdate

    void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)

### inspectAst

    void inspectAst(java.util.EventObject evt = null)

### inspectLast

    void inspectLast(java.util.EventObject evt = null)

### inspectVariables

    void inspectVariables(java.util.EventObject evt = null)

### installInterceptor

    void installInterceptor()

### invokeTextAction

    void invokeTextAction(java.lang.Object evt, java.lang.Object closure, java.lang.Object area = inputArea)

### largerFont

    void largerFont(java.util.EventObject evt = null)

### loadScriptFile

    void loadScriptFile(java.io.File file)

### main

    static void main(java.lang.Object args)

### newScript

    void newScript(java.lang.ClassLoader parent, Binding binding)

### notifySystemErr

    static boolean notifySystemErr(java.lang.String str)

### notifySystemOut

    static boolean notifySystemOut(java.lang.String str)

### paste

    void paste(java.util.EventObject evt = null)

### print

    void print(java.util.EventObject evt = null)

### redo

    void redo(java.util.EventObject evt = null)

### replace

    void replace(java.util.EventObject evt = null)

### run

    void run()

### run

    void run(javax.swing.JApplet applet)

### run

    void run(java.util.Map defaults)

### runScript

    void runScript(java.util.EventObject evt = null)

### runSelectedScript

    void runSelectedScript(java.util.EventObject evt = null)

### selectAll

    void selectAll(java.util.EventObject evt = null)

### selectFilename

    java.lang.Object selectFilename(java.lang.Object name = "Open")

### setDirty

    void setDirty(boolean newDirty)

### setRowNumAndColNum

    void setRowNumAndColNum()

### setVariable

    void setVariable(java.lang.String name, java.lang.Object value)

### showAbout

    void showAbout(java.util.EventObject evt = null)

### showCompilingMessage

    void showCompilingMessage()

### showExecutingMessage

    void showExecutingMessage()

### showMessage

    void showMessage(java.lang.String message)

### showOutputWindow

    void showOutputWindow(java.util.EventObject evt = null)

### showScriptInOutput

    void showScriptInOutput(java.util.EventObject evt)

### showToolbar

    void showToolbar(java.util.EventObject evt)

### smallerFont

    void smallerFont(java.util.EventObject evt = null)

### threadInterruption

    void threadInterruption(java.util.EventObject evt)

### undo

    void undo(java.util.EventObject evt = null)

### updateTitle

    void updateTitle()

### visualizeScriptResults

    void visualizeScriptResults(java.util.EventObject evt)

Groovy Documentation