Documentation of 'org.gjt.sp.jedit.syntax.SyntaxTextArea' Java class
SyntaxTextArea
org.gjt.sp.jedit.syntax

Class SyntaxTextArea

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable


    public class SyntaxTextArea
    extends javax.swing.JEditorPane
    An enhanced JEditorPane useful in text editors. It has the following advantages over the standard Swing text components:
    • Uses the SyntaxEditorKit by default
    • Implements line highlighting, where the line the caret is on has a different background color
    • Implements bracket highlighting, where if the caret is on a bracket, the matching one is highlighted.
    • Has an optional block caret
    • Implements overwrite mode that is toggled by pressing the Insert key
    See Also:
    SyntaxEditorKit, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.text.JTextComponent

        javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static javax.swing.text.EditorKit EDITOR_KIT
      The default editor kit for this text component.
      • Fields inherited from class javax.swing.JEditorPane

        HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
      • Fields inherited from class javax.swing.text.JTextComponent

        DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      SyntaxTextArea()
      Creates a new SyntaxTextArea component.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      javax.swing.text.EditorKit createDefaultEditorKit()
      Returns the default editor kit for this text component.
      void doElectricScroll(java.awt.Rectangle rect)
      Works like Caret.adjustVisibility(), but does `electric' border scrolling (caret is never on the first or last visible line, if it ends up there the display is scrolled up or down)
      boolean getBlockCaret()
      Returns true if a block caret is enabled, false otherwise.
      boolean getBracketHighlight()
      Returns true if bracket highlighting is enabled, false otherwise.
      java.awt.Color getBracketHighlightColor()
      Returns the bracket highlight color.
      int getElectricBorders()
      Returns the number of lines from the top or bottom of the text area from which autoscrolling begins.
      boolean getLineHighlight()
      Returns true if current line highlighting is enabled, false otherwise.
      java.awt.Color getLineHighlightColor()
      Returns the line highlight color.
      boolean getOverwrite(boolean overwrite)
      Returns true if overwrite mode is enabled, false otherwise.
      void setBlockCaret(boolean block)
      Sets the block caret.
      void setBracketHighlight(boolean bracketHighlight)
      Sets the bracket highlighting feature.
      void setBracketHighlightColor(java.awt.Color color)
      Sets the bracket highlight color.
      void setElectricBorders(int lines)
      Sets the number of lines from the top or bottom of the text area from which autoscroll begins.
      void setHighlightedBracket(int bracketPos)
      Sets the highlighted bracket.
      void setHighlightedLine(int lineStart, int lineEnd)
      Sets the currently highlighted line.
      void setLineHighlight(boolean lineHighlight)
      Sets the current line highlighting feature.
      void setLineHighlightColor(java.awt.Color color)
      Sets the line highlight color.
      void setOverwrite(boolean overwrite)
      Sets the overwrite mode.
      void toggleOverwrite()
      Sets the overwrite mode flag to the opposite of it's current value.
      void updateHighlighters()
      Updates the bracket and line highlighters.
      • Methods inherited from class javax.swing.JEditorPane

        addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getText, getUIClassID, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, replaceSelection, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage, setText
      • Methods inherited from class javax.swing.text.JTextComponent

        addCaretListener, addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • EDITOR_KIT

        public static final javax.swing.text.EditorKit EDITOR_KIT
        The default editor kit for this text component.
    • Constructor Detail

      • SyntaxTextArea

        public SyntaxTextArea()
        Creates a new SyntaxTextArea component.
    • Method Detail

      • createDefaultEditorKit

        public javax.swing.text.EditorKit createDefaultEditorKit()
        Returns the default editor kit for this text component.
        Overrides:
        createDefaultEditorKit in class javax.swing.JEditorPane
      • setHighlightedLine

        public void setHighlightedLine(int lineStart,
                                       int lineEnd)
        Sets the currently highlighted line.
        Parameters:
        lineStart - The start offset of the line in the document
        lineEnd - The end offset of the line in the document
      • setLineHighlightColor

        public void setLineHighlightColor(java.awt.Color color)
        Sets the line highlight color.
        Parameters:
        color - The line highlight color
      • getLineHighlightColor

        public java.awt.Color getLineHighlightColor()
        Returns the line highlight color.
      • setLineHighlight

        public void setLineHighlight(boolean lineHighlight)
        Sets the current line highlighting feature.
        Parameters:
        lineHighlight - True if the current line should be highlighted, false otherwise.
      • getLineHighlight

        public boolean getLineHighlight()
        Returns true if current line highlighting is enabled, false otherwise.
      • setHighlightedBracket

        public void setHighlightedBracket(int bracketPos)
        Sets the highlighted bracket.
        Parameters:
        bracketPos - The offset of the bracket in the document
      • setBracketHighlightColor

        public void setBracketHighlightColor(java.awt.Color color)
        Sets the bracket highlight color.
        Parameters:
        color - The bracket highlight color
      • getBracketHighlightColor

        public java.awt.Color getBracketHighlightColor()
        Returns the bracket highlight color.
      • setBracketHighlight

        public void setBracketHighlight(boolean bracketHighlight)
        Sets the bracket highlighting feature.
        Parameters:
        bracketHighlight - True if matching brackets should be highlighted, false otherwise.
      • getBracketHighlight

        public boolean getBracketHighlight()
        Returns true if bracket highlighting is enabled, false otherwise.
      • setElectricBorders

        public void setElectricBorders(int lines)
        Sets the number of lines from the top or bottom of the text area from which autoscroll begins.
        Parameters:
        lines - The number of lines
      • getElectricBorders

        public int getElectricBorders()
        Returns the number of lines from the top or bottom of the text area from which autoscrolling begins.
      • setBlockCaret

        public void setBlockCaret(boolean block)
        Sets the block caret.
        Parameters:
        block - True if a block caret should be drawn, false otherwise
      • getBlockCaret

        public boolean getBlockCaret()
        Returns true if a block caret is enabled, false otherwise.
      • setOverwrite

        public void setOverwrite(boolean overwrite)
        Sets the overwrite mode.
        Parameters:
        overwrite - True if newly inserted characters should overwrite existing ones, false if they should be inserted.
      • getOverwrite

        public boolean getOverwrite(boolean overwrite)
        Returns true if overwrite mode is enabled, false otherwise.
      • toggleOverwrite

        public void toggleOverwrite()
        Sets the overwrite mode flag to the opposite of it's current value.
      • updateHighlighters

        public void updateHighlighters()
        Updates the bracket and line highlighters.
      • doElectricScroll

        public void doElectricScroll(java.awt.Rectangle rect)
        Works like Caret.adjustVisibility(), but does `electric' border scrolling (caret is never on the first or last visible line, if it ends up there the display is scrolled up or down)
        Parameters:
        rect - The rectangle to scroll to

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.