Package: groovy.console.ui

## [Groovy] Class Console

- groovy.console.ui.Console

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

      class Console
      extends Object
      implements CaretListener, HyperlinkListener, ComponentListener, FocusListener

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

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static URL` | `ICON_PATH` | Console window icon resource.

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `static String` | `DEFAULT_SCRIPT_NAME_START` Prefix used for generated script names inside the console.
    `Closure` | `afterExecution` Optional hook invoked after script execution completes.
    `boolean` | `autoClearOutput` Whether output is cleared before each run.
    `Action` | `autoClearOutputAction` Action that toggles automatic output clearing.
    `CompilerConfiguration` | `baseConfig` Base compiler configuration used to seed new scripts.
    `Closure` | `beforeExecution` Optional hook invoked before script execution starts.
    `Component` | `blank` Placeholder component shown when output is detached.
    `static boolean` | `captureStdErr` Whether stderr is redirected into the console output pane.
    `static boolean` | `captureStdOut` Whether stdout is redirected into the console output pane.
    `int` | `colNum` Current one-based caret column.
    `Style` | `commandStyle` Style used for echoed commands in the output pane.
    `CompilerConfiguration` | `config` Compiler configuration for the current script shell.
    `static Object` | `consoleControllers` Active console controllers sharing the global stream interceptors.
    `ConsolePreferences` | `consolePreferences` Lazily created preferences dialog controller.
    `Component` | `copyFromComponent` Last focused text component used by copy/select-all actions.
    `File` | `currentClasspathDir` Initial directory for classpath directory selection dialogs.
    `File` | `currentClasspathJarDir` Initial directory for classpath jar selection dialogs.
    `File` | `currentFileChooserDir` Initial directory for file open/save dialogs.
    `String` | `currentTheme` Name of the currently selected theme mode.
    `int` | `cursorPos` Current caret offset in the input document.
    `boolean` | `detachedOutput` Whether output is shown in a detached window.
    `Action` | `detachedOutputAction` Action that toggles detached output mode.
    `boolean` | `dirty` Whether the current editor contents differ from the saved script.
    `RootPaneContainer` | `frame` Main console frame or dialog.
    `static Object` | `frameConsoleDelegates` Default Swing delegates used to build the console frame and menu bar.
    `boolean` | `fullStackTraces` Whether full stack traces are shown for execution failures.
    `Action` | `fullStackTracesAction` Action that toggles full stack trace output.
    `static Object` | `groovyFileFilter` File filter used for Groovy script open/save dialogs.
    `Action` | `hideOutputWindowAction1` Menu action variant that hides the detached output window.
    `Action` | `hideOutputWindowAction2` Toolbar action variant that hides the detached output window.
    `Action` | `hideOutputWindowAction3` Popup action variant that hides the detached output window.
    `Action` | `hideOutputWindowAction4` Shortcut action variant that hides the detached output window.
    `List` | `history` Execution history records kept for navigation and result lookup.
    `int` | `historyIndex` Index of the currently selected history record.
    `Style` | `hyperlinkStyle` Style used for clickable error links.
    `JTextPane` | `inputArea` Raw text component used for script editing.
    `int` | `inputAreaContentHash` Hash of the last script text scheduled for execution.
    `ConsoleTextEditor` | `inputEditor` Styled text editor used for script input.
    `Action` | `interruptAction` Action that interrupts the active script thread.
    `boolean` | `loopMode` Whether unchanged scripts are rerun after a delay.
    `Action` | `loopModeAction` Action that toggles loop mode.
    `int` | `maxHistory` Maximum number of history entries retained by the console.
    `int` | `maxOutputChars` Maximum number of characters retained in the output pane.
    `Action` | `nextHistoryAction` Action that moves to the next history entry.
    `boolean` | `orientationVertical` Whether the split pane stacks input and output vertically.
    `Action` | `orientationVerticalAction` Action that toggles the split-pane orientation.
    `int` | `origDividerSize` Divider size to restore when output is no longer detached.
    `JTextPane` | `outputArea` Output text pane used for results and errors.
    `PrintWriter` | `outputPrintWriter` Optional writer that mirrors output to a log file.
    `Style` | `outputStyle` Style used for regular output text.
    `Component` | `outputWindow` Detached output window component.
    `HistoryRecord` | `pendingRecord` Pending editor state kept while navigating command history.
    `static Object` | `prefs` User preferences backing console settings.
    `Action` | `prevHistoryAction` Action that moves to the previous history entry.
    `Style` | `promptStyle` Style used for prompt text in the output pane.
    `Style` | `resultStyle` Style used for evaluated result text.
    `Element` | `rootElement` Root document element for row calculations.
    `int` | `rowNum` Current one-based caret row.
    `JLabel` | `rowNumAndColNum` Footer label showing the caret row and column.
    `Thread` | `runThread` Background thread currently compiling or running a script.
    `Action` | `saveAction` Action that saves the current script.
    `boolean` | `saveOnRun` Whether the current script is saved before it is run.
    `Action` | `saveOnRunAction` Action that toggles saving before each run.
    `boolean` | `scaleIconsWithFont`
    `String` | `scriptArgs` Space-separated arguments passed to script execution.
    `Object` | `scriptFile` Current script file or generated script identifier.
    `int` | `scriptNameCounter` Counter used for generated script names.
    `boolean` | `scriptRunning` Whether a script is currently being compiled or executed.
    `Component` | `scrollArea` Scroll container that wraps the output area.
    `Action` | `selectPreviousWordAction` Action that selects the previous word in the editor.
    `Action` | `selectWordAction` Action that selects the next word in the editor.
    `Action` | `setScriptArgsAction` Action that edits the configured script arguments.
    `GroovyShell` | `shell` Shell used to compile and run scripts.
    `Action` | `showOutputWindowAction` Action that shows the detached output window.
    `boolean` | `showScriptInOutput` Whether executed script text is echoed into the output pane.
    `Action` | `showScriptInOutputAction` Action that toggles script echoing in the output pane.
    `boolean` | `showToolbar` Whether the toolbar is visible.
    `Action` | `showToolbarAction` Action that toggles toolbar visibility.
    `static boolean` | `smartHighlighter` Whether the smart syntax highlighter is enabled by default.
    `JSplitPane` | `splitPane` Split pane separating input and output.
    `boolean` | `stackOverFlowError` Whether the last failure was a stack overflow.
    `Style` | `stacktraceStyle` Style used for stack traces and error text.
    `JLabel` | `statusLabel` Status label shown in the footer.
    `SwingBuilder` | `swing` Swing builder used to create and wire the console UI.
    `SystemOutputInterceptor` | `systemErrorInterceptor` Interceptor that captures stderr.
    `SystemOutputInterceptor` | `systemOutInterceptor` Interceptor that captures stdout.
    `int` | `textSelectionEnd` Selection end cached from the caret listener.
    `int` | `textSelectionStart` Selection start cached from the caret listener.
    `boolean` | `threadInterrupt` Whether the `@ThreadInterrupt` transform is applied to scripts.
    `Action` | `threadInterruptAction` Action that toggles thread interruption support.
    `Component` | `toolbar` Toolbar component shown above the editor.
    `boolean` | `useScriptClassLoaderForScriptExecution` Whether script execution uses the shell class loader as context loader.
    `boolean` | `visualizeScriptResults` Whether non-null results are transformed for visual display.
    `Action` | `visualizeScriptResultsAction` Action that toggles result visualization.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `Console(Binding binding)` Creates a console backed by a fresh binding.
    `Console(ClassLoader parent, Binding binding, CompilerConfiguration baseConfig)` Creates a console with the supplied parent loader, binding, and base compiler configuration.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `addClasspathDir(EventObject evt)` Adds a directory to the shell classpath.
    `` | `void` | `addClasspathJar(EventObject evt)` Adds jar files to the shell classpath.
    `` | `void` | `addToHistory(Object record)` Adds a history record and trims the list to the configured maximum size.
    `` | `void` | `appendOutput(String text, AttributeSet style)` Appends plain text to the output pane.
    `` | `void` | `appendOutput(Window window, AttributeSet style)` Appends a window description to the output pane.
    `` | `void` | `appendOutput(Object object, AttributeSet style)` Appends an object's string form to the output pane.
    `` | `void` | `appendOutput(Component component, AttributeSet style)` Appends an embedded component to the output pane.
    `` | `void` | `appendOutput(Icon icon, AttributeSet style)` Appends an embedded icon to the output pane.
    `` | `void` | `appendOutputLines(Object text, Object style)` Appends text and preserves compact line spacing in the output pane.
    `` | `void` | `appendOutputNl(Object text, Object style)` Appends text to the output pane, forcing a preceding line break.
    `` | `void` | `appendStacktrace(Object text)` Appends a stack trace, hyperlinking script line references when possible.
    `` | `void` | `applyIconSize(int size)` Applies a toolbar icon size and refreshes the toolbar.
    `` | `Object` | `askToInterruptScript()` Prompts to interrupt the running script before exiting.
    `` | `boolean` | `askToSaveFile()` Prompts to save unsaved changes before an operation proceeds.
    `` | `void` | `autoClearOutput(EventObject evt)` Toggles whether output is cleared before each run or compile.
    `` | `void` | `beep()` Emits the platform default warning beep.
    `` | `void` | `bindResults()` Refreshes the shell bindings that expose the last result and result history.
    `` | `static void` | `captureStdErr(EventObject evt)` Toggles whether stderr is captured by all console windows.
    `` | `static void` | `captureStdOut(EventObject evt)` Toggles whether stdout is captured by all console windows.
    `` | `void` | `caretUpdate(CaretEvent e)` Updates cached selection bounds and the row/column display.
    `` | `void` | `clearContext(EventObject evt)` Clears the shell binding and starts a fresh script context.
    `` | `void` | `clearOutput(EventObject evt)` Clears all text from the output pane.
    `` | `void` | `closeOutputPrintWriter()` Closes the optional output log writer.
    `` | `void` | `comment(EventObject evt)` Comments or uncomments the current line selection.
    `` | `void` | `compileAsJava(EventObject evt)` Compiles the current editor contents as Java source.
    `` | `Object` | `compileFinishNormal()` Reports successful compilation without execution.
    `` | `void` | `compileScript(EventObject evt, Console.SourceType st)` Compiles the current editor contents without running them.
    `` | `void` | `componentHidden(ComponentEvent e)` No-op component listener implementation.
    `` | `void` | `componentMoved(ComponentEvent e)` No-op component listener implementation.
    `` | `void` | `componentResized(ComponentEvent e)` Persists component dimensions when the editor or frame is resized.
    `` | `void` | `componentShown(ComponentEvent e)` No-op component listener implementation.
    `` | `void` | `copy(EventObject evt)` Copies the current selection from the focused text component.
    `` | `void` | `createOutputPrintWriter(File outputFile)` Opens the configured output log file in append mode.
    `` | `void` | `cut(EventObject evt)` Cuts the current editor selection.
    `` | `void` | `cycleTheme(EventObject evt)` Advances to the next available theme mode.
    `` | `void` | `darkTheme(EventObject evt)` Switches the console to the bundled dark theme.
    `` | `void` | `detachedOutput(EventObject evt)` Toggles whether output is shown in a detached window.
    `` | `void` | `doInterrupt(EventObject evt)` Interrupts the currently running script thread, if any.
    `` | `int` | `dot(CaretEvent e)`
    `` | `boolean` | `exit(EventObject evt)` Closes this console after offering to interrupt and save.
    `` | `void` | `exitDesktop(EventObject evt, Object quitResponse)` Handles desktop quit requests by delegating to exit.
    `` | `void` | `fileNewFile(EventObject evt)` Resets the editor to a new unsaved script.
    `` | `void` | `fileNewWindow(EventObject evt)` Opens another console window seeded with the current binding variables.
    `` | `void` | `fileOpen(EventObject evt)` Prompts for a script file and loads it into the editor.
    `` | `boolean` | `fileSave(EventObject evt)` Saves the current script, prompting for a file when needed.
    `` | `boolean` | `fileSaveAs(EventObject evt)` Saves the current script under a newly selected file name.
    `` | `void` | `find(EventObject evt)` Shows the find dialog.
    `` | `void` | `findNext(EventObject evt)` Repeats the previous find operation in the forward direction.
    `` | `void` | `findPrevious(EventObject evt)` Repeats the previous find operation in the reverse direction.
    `` | `Object` | `finishException(Throwable t, boolean executing)` Reports a compilation or execution failure in the output pane.
    `` | `Object` | `finishNormal(Object result, Long elapsedTime)` Reports successful execution and publishes the resulting value.
    `` | `void` | `focusGained(FocusEvent e)` Tracks the last focused text component for copy and select-all actions.
    `` | `void` | `focusLost(FocusEvent e)` No-op focus listener implementation.
    `` | `void` | `fullStackTraces(EventObject evt)` Toggles whether full stack traces are reported for failures.
    `` | `int` | `getConsoleId()` Returns the identifier used by output interceptors for this console.
    `` | `int` | `getCurrentIconSize()` Returns the current toolbar icon size.
    `` | `Object` | `getLastResult()` Returns the most recent non-null result from execution history.
    `` | `static Icon` | `getNodeIcon()` Returns the icon used for AST and object browser tree nodes.
    `` | `void` | `hideAndClearOutputWindow(EventObject evt)` Clears and then hides the detached output window.
    `` | `void` | `hideOutputWindow(EventObject evt)` Hides the detached output window when detached mode is enabled.
    `` | `void` | `historyNext(EventObject evt)` Moves forward in command history.
    `` | `void` | `historyPrev(EventObject evt)` Moves backward in command history.
    `` | `void` | `hyperlinkUpdate(HyperlinkEvent e)` Highlights the source line referenced by an activated output hyperlink.
    `` | `void` | `insertString(Document doc, int offset, String text, AttributeSet attributeSet, boolean outputToFile)` Inserts text into a document and optionally mirrors it to the output log file.
    `` | `void` | `inspectAst(EventObject evt)` Opens the AST browser for the current editor contents.
    `` | `void` | `inspectCst(EventObject evt)` Opens the CST viewer for the current editor contents.
    `` | `void` | `inspectLast(EventObject evt)` Opens the object browser for the last non-null result.
    `` | `void` | `inspectTokens(EventObject evt)` Opens the lexer token inspector for the current editor contents.
    `` | `void` | `inspectVariables(EventObject evt)` Opens the object browser for the current shell variables.
    `` | `void` | `installInterceptor()` Starts interceptors that route standard output and error into the console.
    `` | `void` | `invokeTextAction(Object evt, Object closure, Object area)` Invokes a text action against the active source component when present.
    `` | `boolean` | `isScaleIconsWithFont()` Returns whether toolbar icons follow the editor font size.
    `` | `void` | `largeIcons(EventObject evt)` Switches toolbar icons to the large preset.
    `` | `void` | `largerFont(EventObject evt)` Increases the editor font size.
    `` | `void` | `lightTheme(EventObject evt)` Switches the console to the bundled light theme.
    `` | `void` | `listClasspath(EventObject evt)` Displays the current shell classpath in a dialog.
    `` | `int` | `loadMaxOutputChars()` Loads the configured output size limit, honoring the system property override.
    `` | `void` | `loadScriptFile(File file)` Loads the supplied script file into the editor.
    `` | `void` | `loopMode(EventObject evt)` Toggles whether the console reruns unchanged scripts after a delay.
    `` | `static void` | `main(Object args)` Launches the console application from the command line.
    `` | `int` | `mark(CaretEvent e)`
    `` | `void` | `newScript(ClassLoader parent, Binding binding)` Recreates the Groovy shell for a new script context.
    `` | `void` | `normalIcons(EventObject evt)` Switches toolbar icons to the normal preset.
    `` | `static boolean` | `notifySystemErr(int consoleId, String str)` Routes captured stderr to the owning console or every console window.
    `` | `static boolean` | `notifySystemOut(int consoleId, String str)` Routes captured stdout to the owning console or every console window.
    `` | `void` | `orientationVertical(EventObject evt)` Toggles the input/output split orientation.
    `` | `static int` | `outputFontSizeFor(int inputFontSize)` HTMLEditorKit scales FontSize values up by ~4/3 (pt→px at 96/72); compensate so the output pane visually matches the input pane.
    `` | `void` | `paste(EventObject evt)` Pastes clipboard text into the input editor.
    `` | `void` | `preferences(EventObject evt)` Shows the console preferences dialog.
    `` | `void` | `print(EventObject evt)` Prints the input editor contents.
    `` | `void` | `reapplyTheme()` Reapplies the current theme and retints console components.
    `` | `void` | `redo(EventObject evt)` Redoes the most recently undone edit in the input editor.
    `` | `void` | `reloadThemes()` Reloads theme definitions and reapplies the active theme.
    `` | `void` | `replace(EventObject evt)` Shows the replace dialog.
    `` | `void` | `run()` Builds and shows the console UI using default delegates.
    `` | `void` | `run(Map defaults)` Builds and shows the console UI using the supplied Swing delegates.
    `` | `void` | `runJava(EventObject evt)` Compiles and runs the current editor contents as Java source.
    `` | `void` | `runScript(EventObject evt, Console.SourceType st)` Compiles and runs the current editor contents.
    `` | `void` | `runSelectedJava(EventObject evt)` Compiles and runs the current selection as Java source.
    `` | `void` | `runSelectedScript(EventObject evt, Console.SourceType st)` Compiles and runs only the current editor selection.
    `` | `void` | `saveOnRun(EventObject evt)` Toggles whether scripts are saved before they run.
    `` | `void` | `scaleIconsWithFont(EventObject evt)` Toggles whether toolbar icons track the editor font size.
    `` | `void` | `selectAll(EventObject evt)` Selects all text in the focused text component.
    `` | `void` | `selectBlock(EventObject evt)` Expands the selection from word to line to surrounding block.
    `` | `Object` | `selectFilename(Object name)` Opens a file chooser and returns the selected script file.
    `` | `void` | `setDirty(boolean newDirty)` Marks the editor dirty state and refreshes save affordances.
    `` | `void` | `setOutputPreferences(boolean useOutputFile, File outputFile)` Updates output mirroring preferences and recreates the log writer if needed.
    `` | `void` | `setRowNumAndColNum()` Updates the cached caret row and column display.
    `` | `void` | `setScaleIconsWithFont(boolean enabled)` Persists whether toolbar icons track the editor font size.
    `` | `void` | `setScriptArgs(EventObject evt)` Prompts for space-separated script arguments used by future runs.
    `` | `void` | `setVariable(String name, Object value)` Adds a variable to the shell binding.
    `` | `void` | `showAbout(EventObject evt)` Shows the about dialog for the console.
    `` | `void` | `showCompilingMessage()` Shows the standard script-compiling status message.
    `` | `void` | `showExecutingMessage()` Shows the standard script-executing status message.
    `` | `void` | `showMessage(String message)` Updates the status bar with the supplied message.
    `` | `void` | `showOutputWindow(EventObject evt)` Shows the detached output window when detached mode is enabled.
    `` | `void` | `showScriptInOutput(EventObject evt)` Toggles whether executed source text is echoed to the output pane.
    `` | `void` | `showToolbar(EventObject evt)` Toggles toolbar visibility and persists the selection.
    `` | `void` | `smallIcons(EventObject evt)` Switches toolbar icons to the small preset.
    `` | `void` | `smallerFont(EventObject evt)` Decreases the editor font size.
    `` | `void` | `smartHighlighter(EventObject evt)` Switches between smart and regex-based syntax highlighters.
    `` | `void` | `systemTheme(EventObject evt)` Switches the console to follow the operating system theme.
    `` | `void` | `threadInterruption(EventObject evt)` Toggles the `@ThreadInterrupt` transform for future scripts.
    `` | `void` | `undo(EventObject evt)` Undoes the most recent edit in the input editor.
    `` | `void` | `updateTitle()` Updates the main window title to reflect the current script and dirty state.
    `` | `void` | `visualizeScriptResults(EventObject evt)` Toggles whether results are transformed before display.

  - ### Inherited Methods Summary

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

- - ### Field Detail

    - #### public static URL ICON_PATH

      Console window icon resource.

  - ### Property Detail

    - #### static final String DEFAULT_SCRIPT_NAME_START

      Prefix used for generated script names inside the console.

    - #### Closure afterExecution

      Optional hook invoked after script execution completes.

    - #### boolean autoClearOutput

      Whether output is cleared before each run.

    - #### Action autoClearOutputAction

      Action that toggles automatic output clearing.

    - #### CompilerConfiguration baseConfig

      Base compiler configuration used to seed new scripts.

    - #### Closure beforeExecution

      Optional hook invoked before script execution starts.

    - #### Component blank

      Placeholder component shown when output is detached.

    - #### static boolean captureStdErr

      Whether stderr is redirected into the console output pane.

    - #### static boolean captureStdOut

      Whether stdout is redirected into the console output pane.

    - #### int colNum

      Current one-based caret column.

    - #### Style commandStyle

      Style used for echoed commands in the output pane.

    - #### CompilerConfiguration config

      Compiler configuration for the current script shell.

    - #### static Object consoleControllers

      Active console controllers sharing the global stream interceptors.

    - #### ConsolePreferences consolePreferences

      Lazily created preferences dialog controller.

    - #### Component copyFromComponent

      Last focused text component used by copy/select-all actions.

    - #### File currentClasspathDir

      Initial directory for classpath directory selection dialogs.

    - #### File currentClasspathJarDir

      Initial directory for classpath jar selection dialogs.

    - #### File currentFileChooserDir

      Initial directory for file open/save dialogs.

    - #### String currentTheme

      Name of the currently selected theme mode.

    - #### int cursorPos

      Current caret offset in the input document.

    - #### boolean detachedOutput

      Whether output is shown in a detached window.

    - #### Action detachedOutputAction

      Action that toggles detached output mode.

    - #### boolean dirty

      Whether the current editor contents differ from the saved script.

    - #### RootPaneContainer frame

      Main console frame or dialog.

    - #### static Object frameConsoleDelegates

      Default Swing delegates used to build the console frame and menu bar.

    - #### boolean fullStackTraces

      Whether full stack traces are shown for execution failures.

    - #### Action fullStackTracesAction

      Action that toggles full stack trace output.

    - #### static Object groovyFileFilter

      File filter used for Groovy script open/save dialogs.

    - #### Action hideOutputWindowAction1

      Menu action variant that hides the detached output window.

    - #### Action hideOutputWindowAction2

      Toolbar action variant that hides the detached output window.

    - #### Action hideOutputWindowAction3

      Popup action variant that hides the detached output window.

    - #### Action hideOutputWindowAction4

      Shortcut action variant that hides the detached output window.

    - #### List history

      Execution history records kept for navigation and result lookup.

    - #### int historyIndex

      Index of the currently selected history record.

    - #### Style hyperlinkStyle

      Style used for clickable error links.

    - #### JTextPane inputArea

      Raw text component used for script editing.

    - #### int inputAreaContentHash

      Hash of the last script text scheduled for execution.

    - #### ConsoleTextEditor inputEditor

      Styled text editor used for script input.

    - #### Action interruptAction

      Action that interrupts the active script thread.

    - #### boolean loopMode

      Whether unchanged scripts are rerun after a delay.

    - #### Action loopModeAction

      Action that toggles loop mode.

    - #### int maxHistory

      Maximum number of history entries retained by the console.

    - #### int maxOutputChars

      Maximum number of characters retained in the output pane.

    - #### Action nextHistoryAction

      Action that moves to the next history entry.

    - #### boolean orientationVertical

      Whether the split pane stacks input and output vertically.

    - #### Action orientationVerticalAction

      Action that toggles the split-pane orientation.

    - #### int origDividerSize

      Divider size to restore when output is no longer detached.

    - #### JTextPane outputArea

      Output text pane used for results and errors.

    - #### PrintWriter outputPrintWriter

      Optional writer that mirrors output to a log file.

    - #### Style outputStyle

      Style used for regular output text.

    - #### Component outputWindow

      Detached output window component.

    - #### HistoryRecord pendingRecord

      Pending editor state kept while navigating command history.

    - #### static Object prefs

      User preferences backing console settings.

    - #### Action prevHistoryAction

      Action that moves to the previous history entry.

    - #### Style promptStyle

      Style used for prompt text in the output pane.

    - #### Style resultStyle

      Style used for evaluated result text.

    - #### Element rootElement

      Root document element for row calculations.

    - #### int rowNum

      Current one-based caret row.

    - #### JLabel rowNumAndColNum

      Footer label showing the caret row and column.

    - #### Thread runThread

      Background thread currently compiling or running a script.

    - #### Action saveAction

      Action that saves the current script.

    - #### boolean saveOnRun

      Whether the current script is saved before it is run.

    - #### Action saveOnRunAction

      Action that toggles saving before each run.

    - #### boolean scaleIconsWithFont

    - #### String scriptArgs

      Space-separated arguments passed to script execution.

    - #### Object scriptFile

      Current script file or generated script identifier.

    - #### int scriptNameCounter

      Counter used for generated script names.

    - #### boolean scriptRunning

      Whether a script is currently being compiled or executed.

    - #### Component scrollArea

      Scroll container that wraps the output area.

    - #### Action selectPreviousWordAction

      Action that selects the previous word in the editor.

    - #### Action selectWordAction

      Action that selects the next word in the editor.

    - #### Action setScriptArgsAction

      Action that edits the configured script arguments.

    - #### GroovyShell shell

      Shell used to compile and run scripts.

    - #### Action showOutputWindowAction

      Action that shows the detached output window.

    - #### boolean showScriptInOutput

      Whether executed script text is echoed into the output pane.

    - #### Action showScriptInOutputAction

      Action that toggles script echoing in the output pane.

    - #### boolean showToolbar

      Whether the toolbar is visible.

    - #### Action showToolbarAction

      Action that toggles toolbar visibility.

    - #### static boolean smartHighlighter

      Whether the smart syntax highlighter is enabled by default.

    - #### JSplitPane splitPane

      Split pane separating input and output.

    - #### boolean stackOverFlowError

      Whether the last failure was a stack overflow.

    - #### Style stacktraceStyle

      Style used for stack traces and error text.

    - #### JLabel statusLabel

      Status label shown in the footer.

    - #### SwingBuilder swing

      Swing builder used to create and wire the console UI.

    - #### SystemOutputInterceptor systemErrorInterceptor

      Interceptor that captures stderr.

    - #### SystemOutputInterceptor systemOutInterceptor

      Interceptor that captures stdout.

    - #### int textSelectionEnd

      Selection end cached from the caret listener.

    - #### int textSelectionStart

      Selection start cached from the caret listener.

    - #### boolean threadInterrupt

      Whether the `@ThreadInterrupt` transform is applied to scripts.

    - #### Action threadInterruptAction

      Action that toggles thread interruption support.

    - #### Component toolbar

      Toolbar component shown above the editor.

    - #### boolean useScriptClassLoaderForScriptExecution

      Whether script execution uses the shell class loader as context loader.

    - #### boolean visualizeScriptResults

      Whether non-null results are transformed for visual display.

    - #### Action visualizeScriptResultsAction

      Action that toggles result visualization.

  - ### Constructor Detail

    - #### Console(Binding binding)

      Creates a console backed by a fresh binding.

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

      Creates a console with the supplied parent loader, binding, and base compiler configuration.

  - ### Method Detail

    - #### void addClasspathDir(EventObject evt)

      Adds a directory to the shell classpath.

    - #### void addClasspathJar(EventObject evt)

      Adds jar files to the shell classpath.

    - #### void addToHistory(Object record)

      Adds a history record and trims the list to the configured maximum size.

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

      Appends plain text to the output pane.

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

      Appends a window description to the output pane.

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

      Appends an object's string form to the output pane.

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

      Appends an embedded component to the output pane.

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

      Appends an embedded icon to the output pane.

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

      Appends text and preserves compact line spacing in the output pane.

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

      Appends text to the output pane, forcing a preceding line break.

    - #### void appendStacktrace(Object text)

      Appends a stack trace, hyperlinking script line references when possible.

    - #### void applyIconSize(int size)

      Applies a toolbar icon size and refreshes the toolbar.

      Since:
        6.0.0

    - #### Object askToInterruptScript()

      Prompts to interrupt the running script before exiting.

    - #### boolean askToSaveFile()

      Prompts to save unsaved changes before an operation proceeds.

    - #### void autoClearOutput(EventObject evt)

      Toggles whether output is cleared before each run or compile.

    - #### void beep()

      Emits the platform default warning beep.

    - #### void bindResults()

      Refreshes the shell bindings that expose the last result and result history.

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

      Toggles whether stderr is captured by all console windows.

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

      Toggles whether stdout is captured by all console windows.

    - #### void caretUpdate(CaretEvent e)

      Updates cached selection bounds and the row/column display.

    - #### void clearContext(EventObject evt)

      Clears the shell binding and starts a fresh script context.

    - #### void clearOutput(EventObject evt)

      Clears all text from the output pane.

    - #### void closeOutputPrintWriter()

      Closes the optional output log writer.

    - #### void comment(EventObject evt)

      Comments or uncomments the current line selection.

    - #### void compileAsJava(EventObject evt)

      Compiles the current editor contents as Java source.

    - #### Object compileFinishNormal()

      Reports successful compilation without execution.

    - #### void compileScript(EventObject evt, Console.SourceType st)

      Compiles the current editor contents without running them.

    - #### void componentHidden(ComponentEvent e)

      No-op component listener implementation.

    - #### void componentMoved(ComponentEvent e)

      No-op component listener implementation.

    - #### void componentResized(ComponentEvent e)

      Persists component dimensions when the editor or frame is resized.

    - #### void componentShown(ComponentEvent e)

      No-op component listener implementation.

    - #### void copy(EventObject evt)

      Copies the current selection from the focused text component.

    - #### void createOutputPrintWriter(File outputFile)

      Opens the configured output log file in append mode.

    - #### void cut(EventObject evt)

      Cuts the current editor selection.

    - #### void cycleTheme(EventObject evt)

      Advances to the next available theme mode.

      Since:
        6.0.0

    - #### void darkTheme(EventObject evt)

      Switches the console to the bundled dark theme.

      Since:
        6.0.0

    - #### void detachedOutput(EventObject evt)

      Toggles whether output is shown in a detached window.

    - #### void doInterrupt(EventObject evt)

      Interrupts the currently running script thread, if any.

    - #### @CompileStatic
      int dot(CaretEvent e)

    - #### boolean exit(EventObject evt)

      Closes this console after offering to interrupt and save.

    - #### void exitDesktop(EventObject evt, Object quitResponse)

      Handles desktop quit requests by delegating to exit.

    - #### void fileNewFile(EventObject evt)

      Resets the editor to a new unsaved script.

    - #### void fileNewWindow(EventObject evt)

      Opens another console window seeded with the current binding variables.

    - #### void fileOpen(EventObject evt)

      Prompts for a script file and loads it into the editor.

    - #### boolean fileSave(EventObject evt)

      Saves the current script, prompting for a file when needed.

    - #### boolean fileSaveAs(EventObject evt)

      Saves the current script under a newly selected file name.

    - #### void find(EventObject evt)

      Shows the find dialog.

    - #### void findNext(EventObject evt)

      Repeats the previous find operation in the forward direction.

    - #### void findPrevious(EventObject evt)

      Repeats the previous find operation in the reverse direction.

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

      Reports a compilation or execution failure in the output pane.

    - #### Object finishNormal(Object result, Long elapsedTime)

      Reports successful execution and publishes the resulting value.

    - #### void focusGained(FocusEvent e)

      Tracks the last focused text component for copy and select-all actions.

    - #### void focusLost(FocusEvent e)

      No-op focus listener implementation.

    - #### void fullStackTraces(EventObject evt)

      Toggles whether full stack traces are reported for failures.

    - #### int getConsoleId()

      Returns the identifier used by output interceptors for this console.

    - #### int getCurrentIconSize()

      Returns the current toolbar icon size.

      Since:
        6.0.0

    - #### Object getLastResult()

      Returns the most recent non-null result from execution history.

    - #### static Icon getNodeIcon()

      Returns the icon used for AST and object browser tree nodes.

      Since:
        6.0.0

    - #### void hideAndClearOutputWindow(EventObject evt)

      Clears and then hides the detached output window.

    - #### void hideOutputWindow(EventObject evt)

      Hides the detached output window when detached mode is enabled.

    - #### void historyNext(EventObject evt)

      Moves forward in command history.

    - #### void historyPrev(EventObject evt)

      Moves backward in command history.

    - #### void hyperlinkUpdate(HyperlinkEvent e)

      Highlights the source line referenced by an activated output hyperlink.

    - #### void insertString(Document doc, int offset, String text, AttributeSet attributeSet, boolean outputToFile)

      Inserts text into a document and optionally mirrors it to the output log file.

    - #### void inspectAst(EventObject evt)

      Opens the AST browser for the current editor contents.

    - #### void inspectCst(EventObject evt)

      Opens the CST viewer for the current editor contents.

    - #### void inspectLast(EventObject evt)

      Opens the object browser for the last non-null result.

    - #### void inspectTokens(EventObject evt)

      Opens the lexer token inspector for the current editor contents.

    - #### void inspectVariables(EventObject evt)

      Opens the object browser for the current shell variables.

    - #### void installInterceptor()

      Starts interceptors that route standard output and error into the console.

    - #### void invokeTextAction(Object evt, Object closure, Object area)

      Invokes a text action against the active source component when present.

    - #### boolean isScaleIconsWithFont()

      Returns whether toolbar icons follow the editor font size.

      Since:
        6.0.0

    - #### void largeIcons(EventObject evt)

      Switches toolbar icons to the large preset.

      Since:
        6.0.0

    - #### void largerFont(EventObject evt)

      Increases the editor font size.

    - #### void lightTheme(EventObject evt)

      Switches the console to the bundled light theme.

      Since:
        6.0.0

    - #### void listClasspath(EventObject evt)

      Displays the current shell classpath in a dialog.

    - #### int loadMaxOutputChars()

      Loads the configured output size limit, honoring the system property override.

    - #### void loadScriptFile(File file)

      Loads the supplied script file into the editor.

    - #### void loopMode(EventObject evt)

      Toggles whether the console reruns unchanged scripts after a delay.

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

      Launches the console application from the command line.

    - #### @CompileStatic
      int mark(CaretEvent e)

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

      Recreates the Groovy shell for a new script context.

    - #### void normalIcons(EventObject evt)

      Switches toolbar icons to the normal preset.

      Since:
        6.0.0

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

      Routes captured stderr to the owning console or every console window.

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

      Routes captured stdout to the owning console or every console window.

    - #### void orientationVertical(EventObject evt)

      Toggles the input/output split orientation.

    - #### static int outputFontSizeFor(int inputFontSize)

      HTMLEditorKit scales FontSize values up by ~4/3 (pt→px at 96/72); compensate so the output pane visually matches the input pane.

      Since:
        6.0.0

    - #### void paste(EventObject evt)

      Pastes clipboard text into the input editor.

    - #### void preferences(EventObject evt)

      Shows the console preferences dialog.

    - #### void print(EventObject evt)

      Prints the input editor contents.

    - #### void reapplyTheme()

      Reapplies the current theme and retints console components.

      Since:
        6.0.0

    - #### void redo(EventObject evt)

      Redoes the most recently undone edit in the input editor.

    - #### void reloadThemes()

      Reloads theme definitions and reapplies the active theme.

      Since:
        6.0.0

    - #### void replace(EventObject evt)

      Shows the replace dialog.

    - #### void run()

      Builds and shows the console UI using default delegates.

    - #### void run(Map defaults)

      Builds and shows the console UI using the supplied Swing delegates.

    - #### void runJava(EventObject evt)

      Compiles and runs the current editor contents as Java source.

    - #### void runScript(EventObject evt, Console.SourceType st)

      Compiles and runs the current editor contents.

    - #### void runSelectedJava(EventObject evt)

      Compiles and runs the current selection as Java source.

    - #### void runSelectedScript(EventObject evt, Console.SourceType st)

      Compiles and runs only the current editor selection.

    - #### void saveOnRun(EventObject evt)

      Toggles whether scripts are saved before they run.

    - #### void scaleIconsWithFont(EventObject evt)

      Toggles whether toolbar icons track the editor font size.

      Since:
        6.0.0

    - #### void selectAll(EventObject evt)

      Selects all text in the focused text component.

    - #### void selectBlock(EventObject evt)

      Expands the selection from word to line to surrounding block.

    - #### Object selectFilename(Object name)

      Opens a file chooser and returns the selected script file.

    - #### void setDirty(boolean newDirty)

      Marks the editor dirty state and refreshes save affordances.

    - #### void setOutputPreferences(boolean useOutputFile, File outputFile)

      Updates output mirroring preferences and recreates the log writer if needed.

    - #### void setRowNumAndColNum()

      Updates the cached caret row and column display.

    - #### void setScaleIconsWithFont(boolean enabled)

      Persists whether toolbar icons track the editor font size.

      Since:
        6.0.0

    - #### void setScriptArgs(EventObject evt)

      Prompts for space-separated script arguments used by future runs.

      Since:
        6.0.0

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

      Adds a variable to the shell binding.

    - #### void showAbout(EventObject evt)

      Shows the about dialog for the console.

    - #### void showCompilingMessage()

      Shows the standard script-compiling status message.

    - #### void showExecutingMessage()

      Shows the standard script-executing status message.

    - #### void showMessage(String message)

      Updates the status bar with the supplied message.

    - #### void showOutputWindow(EventObject evt)

      Shows the detached output window when detached mode is enabled.

    - #### void showScriptInOutput(EventObject evt)

      Toggles whether executed source text is echoed to the output pane.

    - #### void showToolbar(EventObject evt)

      Toggles toolbar visibility and persists the selection.

    - #### void smallIcons(EventObject evt)

      Switches toolbar icons to the small preset.

      Since:
        6.0.0

    - #### void smallerFont(EventObject evt)

      Decreases the editor font size.

    - #### void smartHighlighter(EventObject evt)

      Switches between smart and regex-based syntax highlighters.

    - #### void systemTheme(EventObject evt)

      Switches the console to follow the operating system theme.

      Since:
        6.0.0

    - #### void threadInterruption(EventObject evt)

      Toggles the `@ThreadInterrupt` transform for future scripts.

    - #### void undo(EventObject evt)

      Undoes the most recent edit in the input editor.

    - #### void updateTitle()

      Updates the main window title to reflect the current script and dirty state.

    - #### void visualizeScriptResults(EventObject evt)

      Toggles whether results are transformed before display.