Package: groovy.console.ui

## [Java] Class ConsoleTextEditor

- groovy.console.ui.ConsoleTextEditor

-     public class ConsoleTextEditor
      extends JScrollPane

  Component which provides a styled editor for the console.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class JScrollPane` | `VIEWPORT, VERTICAL_SCROLLBAR, HORIZONTAL_SCROLLBAR, ROW_HEADER, COLUMN_HEADER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, LOWER_LEADING_CORNER, LOWER_TRAILING_CORNER, UPPER_LEADING_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR_POLICY, HORIZONTAL_SCROLLBAR_POLICY, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ConsoleTextEditor()` Creates a styled text editor with line numbers, undo/redo support, printing support, and syntax highlighting.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `clipBoardAvailable()` Reports whether plain-text clipboard content is currently available.
    `` | `public void` | `enableHighLighter(Class<? extends DocumentFilter> clazz)` Replaces the current syntax highlighter document filter.
    `` | `public String` | `getDefaultFamily()` Returns the preferred monospaced font family for the editor.
    `` | `public Action` | `getPrintAction()` Returns the action that prints the editor content.
    `` | `public Action` | `getRedoAction()` Returns the action that redoes the most recently undone edit.
    `` | `public TextEditor` | `getTextEditor()` Returns the wrapped text editor component.
    `` | `public Action` | `getUndoAction()` Returns the action that undoes the most recent edit.
    `` | `public TextUndoManager` | `getUndoManager()` Returns the undo manager backing this editor.
    `` | `protected void` | `initActions()` Installs actions exposed by this editor on its action map.
    `` | `public void` | `reapplyHighlighting()` Re-run the syntax highlighter on the full document so character attributes match the current theme.
    `` | `public void` | `setDefaultFamily(String defaultFamily)` Sets the preferred monospaced font family for the editor.
    `` | `public void` | `setEditable(boolean editable)` Updates whether the text editor accepts user edits.
    `` | `public void` | `setShowLineNumbers(boolean showLineNumbers)` Shows or hides the line-number gutter.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class JScrollPane` | `action, add, add, add, add, add, add, addAncestorListener, addComponentListener, addContainerListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, computeVisibleRect, contains, contains, countComponents, createHorizontalScrollBar, createImage, createImage, createToolTip, createVerticalScrollBar, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, equals, findComponentAt, findComponentAt, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBackground, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getBounds, getClass, getClientProperty, getColorModel, getColumnHeader, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponentListeners, getComponentOrientation, getComponentPopupMenu, getComponentZOrder, getComponents, getConditionForKeyStroke, getContainerListeners, getCorner, getCursor, getDebugGraphicsOptions, getDefaultLocale, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFocusTraversalPolicy, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getIgnoreRepaint, getInheritsPopupMenu, getInputContext, getInputMap, getInputMap, getInputMethodListeners, getInputMethodRequests, getInputVerifier, getInsets, getInsets, getKeyListeners, getLayout, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMousePosition, getMouseWheelListeners, getName, getNextFocusableComponent, getParent, getPopupLocation, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getRowHeader, getSize, getSize, getToolTipLocation, getToolTipText, getToolTipText, getToolkit, getTopLevelAncestor, getTransferHandler, getTreeLock, getUI, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVerticalScrollBar, getVerticalScrollBarPolicy, getVetoableChangeListeners, getViewport, getViewportBorder, getViewportBorderBounds, getVisibleRect, getWidth, getX, getY, gotFocus, grabFocus, handleEvent, hasFocus, hashCode, hide, imageUpdate, insets, inside, invalidate, isAncestorOf, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isFocusable, isFontSet, isForegroundSet, isLightweight, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isShowing, isValid, isValidateRoot, isVisible, isWheelScrollingEnabled, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, notify, notifyAll, paint, paintAll, paintComponents, paintImmediately, paintImmediately, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printComponents, putClientProperty, registerKeyboardAction, registerKeyboardAction, remove, remove, remove, removeAll, removeAncestorListener, removeComponentListener, removeContainerListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, repaint, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, resize, resize, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setBounds, setBounds, setColumnHeader, setColumnHeaderView, setComponentOrientation, setComponentPopupMenu, setComponentZOrder, setCorner, setCursor, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setDropTarget, setEnabled, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFocusable, setFont, setForeground, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setIgnoreRepaint, setInheritsPopupMenu, setInputMap, setInputVerifier, setLayout, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setRowHeader, setRowHeaderView, setSize, setSize, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setVisible, setWheelScrollingEnabled, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusDownCycle, transferFocusUpCycle, unregisterKeyboardAction, update, updateUI, validate, wait, wait, wait`

- - ### Constructor Detail

    - #### public ConsoleTextEditor()

      Creates a styled text editor with line numbers, undo/redo support, printing support, and syntax highlighting.

  - ### Method Detail

    - #### public boolean clipBoardAvailable()

      Reports whether plain-text clipboard content is currently available.

      Returns:
        `true` if the clipboard contains a string

    - #### public void enableHighLighter(Class<? extends DocumentFilter> clazz)

      Replaces the current syntax highlighter document filter.

      Parameters:
        `clazz` - the filter type to instantiate for the current document

    - #### public String getDefaultFamily()

      Returns the preferred monospaced font family for the editor.

      Returns:
        the default font family name

    - #### public Action getPrintAction()

      Returns the action that prints the editor content.

      Returns:
        the print action

    - #### public Action getRedoAction()

      Returns the action that redoes the most recently undone edit.

      Returns:
        the redo action

    - #### public TextEditor getTextEditor()

      Returns the wrapped text editor component.

      Returns:
        the embedded text editor

    - #### public Action getUndoAction()

      Returns the action that undoes the most recent edit.

      Returns:
        the undo action

    - #### public TextUndoManager getUndoManager()

      Returns the undo manager backing this editor.

      Returns:
        the editor undo manager
      Since:
        6.0.0

    - #### protected void initActions()

      Installs actions exposed by this editor on its action map.

    - #### public void reapplyHighlighting()

      Re-run the syntax highlighter on the full document so character attributes match the current theme. Undo recording is suppressed so this doesn't pollute the undo/redo stack. Used after undo/redo because UndoableEdits restore attributes captured at edit time, which may no longer match the active theme.

      Since:
        6.0.0

    - #### public void setDefaultFamily(String defaultFamily)

      Sets the preferred monospaced font family for the editor.

      Parameters:
        `defaultFamily` - the font family name to use

    - #### public void setEditable(boolean editable)

      Updates whether the text editor accepts user edits.

      Parameters:
        `editable` - `true` if the editor should be editable

    - #### public void setShowLineNumbers(boolean showLineNumbers)

      Shows or hides the line-number gutter.

      Parameters:
        `showLineNumbers` - `true` to show line numbers