protected void paintHighlight(Graphics gfx, int line, int y) { if(line >= textArea.getSelectionStartLine() && line <= textArea.getSelectionEndLine()) paintLineHighlight(gfx,line,y); if(highlights != null) highlights.paintHighlight(gfx,line,y); if(bracketHighlight && line == textArea.getBracketLine()) paintBracketHighlight(gfx,line,y); if(line == textArea.getCaretLine()) paintCaret(gfx,line,y); }
public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); textArea.setOverwriteEnabled( !textArea.isOverwriteEnabled()); } }
/** * Sets the bracket highlight color. * @param bracketHighlightColor The bracket highlight color */ public final void setBracketHighlightColor(Color bracketHighlightColor) { this.bracketHighlightColor = bracketHighlightColor; invalidateLine(textArea.getBracketLine()); }
public static KeywordMap getKeywordMap() { if (tsqlKeywords == null) { tsqlKeywords = new KeywordMap(true); addKeywords(); addDataTypes(); addSystemFunctions(); addOperators(); addSystemStoredProcedures(); addSystemTables(); } return tsqlKeywords; }
public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); if(select) textArea.select(textArea.getMarkPosition(),0); else textArea.setCaretPosition(0); } }
/** * Repaints the lines containing the selection. */ public final void invalidateSelectedLines() { invalidateLineRange(textArea.getSelectionStartLine(), textArea.getSelectionEndLine()); }
public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); textArea.setSelectionRectangular( !textArea.isSelectionRectangular()); } }
/** * Converts a point to an offset, from the start of the text. * @param x The x co-ordinate of the point * @param y The y co-ordinate of the point */ public int xyToOffset(int x, int y) { int line = yToLine(y); int start = getLineStartOffset(line); return start + xToOffset(line,x); }
public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); doIt(textArea); } protected abstract void doIt(JEditTextArea ta);
/** * Moves the mark to the caret position. */ public final void selectNone() { select(getCaretPosition(),getCaretPosition()); }
/** * Sets if the caret should be visible. * @param caretVisible True if the caret should be visible, false * otherwise */ public void setCaretVisible(boolean caretVisible) { this.caretVisible = caretVisible; blink = true; painter.invalidateSelectedLines(); }
/** * Returns a copy of this input handler that shares the same * key bindings. Setting key bindings in the copy will also * set them in the original. */ public InputHandler copy() { return new DefaultInputHandler(this); }
/** * Creates a new JEditTextArea with the default settings. */ public JEditTextArea() { this(TextAreaDefaults.getDefaults()); }
/** * Returns the length of the document. Equivalent to calling * <code>getDocument().getLength()</code>. */ public final int getDocumentLength() { return document.getLength(); }
/** * Sets the selection end. The new selection will be the old * selection start and the bew selection end. * @param selectionEnd The selection end * @see #select(int,int) */ public final void setSelectionEnd(int selectionEnd) { select(selectionStart,selectionEnd); }
public void focusLost(FocusEvent evt) { setCaretVisible(false); focusedComponent = null; } }
/** * Sets the document's token marker. Equivalent to caling * <code>getDocument().setTokenMarker()</code>. * @param tokenMarker The token marker */ public final void setTokenMarker(TokenMarker tokenMarker) { document.setTokenMarker(tokenMarker); }
public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); if(select) textArea.select(textArea.getMarkPosition(), textArea.getDocumentLength()); else textArea.setCaretPosition(textArea .getDocumentLength()); } }
/** * Enables or disables bracket highlighting. * When bracket highlighting is enabled, the bracket matching the * one before the caret (if any) is highlighted. * @param bracketHighlight True if bracket highlighting should be * enabled, false otherwise */ public final void setBracketHighlightEnabled(boolean bracketHighlight) { this.bracketHighlight = bracketHighlight; invalidateLine(textArea.getBracketLine()); }
/** * Sets if overwrite mode should be enabled. * @param overwrite True if overwrite mode should be enabled, * false otherwise. */ public final void setOverwriteEnabled(boolean overwrite) { this.overwrite = overwrite; painter.invalidateSelectedLines(); }