@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { textArea.setCaretPosition(textArea.getCaretPosition()); }
private RCompoundEdit startCompoundEdit(UndoableEdit edit) { lastOffset = textArea.getCaretPosition(); compoundEdit = new RCompoundEdit(); compoundEdit.addEdit(edit); addEdit(compoundEdit); return compoundEdit; }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { try { int offs = textArea.getCaretPosition(); int begOffs = getWordStart(textArea, offs); if (select) { textArea.moveCaretPosition(begOffs); } else { textArea.setCaretPosition(begOffs); } } catch (BadLocationException ble) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { try { int offs = textArea.getCaretPosition(); int endOffs = getWordEnd(textArea, offs); if (select) { textArea.moveCaretPosition(endOffs); } else { textArea.setCaretPosition(endOffs); } } catch (BadLocationException ble) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
selectedIndex = textArea.getCaretPosition(); if(selectedIndex != -1) { if (left) {
int dot = textArea.getCaretPosition(); if (dot == 0) { return; if (word.startsWith(lastPrefix)) { textArea.replaceRange(word, lastWordStart, dot); lastDot = textArea.getCaretPosition(); // Maybe shifted break;
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { try { // We use the elements instead of calling getLineOfOffset(), // etc. to speed things up just a tad (i.e. micro-optimize). Document document = textArea.getDocument(); int caretPosition = textArea.getCaretPosition(); Element map = document.getDefaultRootElement(); int currentLineNum = map.getElementIndex(caretPosition); Element currentLineElement = map.getElement(currentLineNum); // Always take -1 as we don't want to remove the newline. int currentLineEnd = currentLineElement.getEndOffset()-1; if (caretPosition<currentLineEnd) { document.remove(caretPosition, currentLineEnd-caretPosition); } } catch (BadLocationException ble) { ble.printStackTrace(); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { int offs = textArea.getCaretPosition(); boolean failed = false; try {
int offs = textArea.getCaretPosition(); int caretPosition = textArea.getCaretPosition(); Document document = textArea.getDocument(); Element map = document.getDefaultRootElement();
int dot = textArea.getCaretPosition(); int mark = textArea.getCaret().getMark(); Document doc = textArea.getDocument();
int selectedIndex = textArea.getCaretPosition(); int scrollAmount = textArea.getScrollableBlockIncrement( visible, SwingConstants.VERTICAL, direction);
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { int offs = textArea.getCaretPosition(); int endOffs = 0; try { if (textArea.getLineWrap()) { // Must check per character, since one logical line may be // many physical lines. // FIXME: Replace Utilities call with custom version to // cut down on all of the modelToViews, as each call causes // a getTokenList => expensive! endOffs = Utilities.getRowEnd(textArea, offs); } else { Element root = textArea.getDocument().getDefaultRootElement(); int line = root.getElementIndex(offs); endOffs = root.getElement(line).getEndOffset() - 1; } if (select) { textArea.moveCaretPosition(endOffs); } else { textArea.setCaretPosition(endOffs); } } catch (Exception ex) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { int offs = textArea.getCaretPosition(); int oldOffs = offs; Element curPara = Utilities.getParagraphElement(textArea, offs);
int diff = textArea.getCaretPosition() - lastOffset;
r = textArea.modelToView(textArea.getCaretPosition()); } catch (Exception e) { e.printStackTrace();
@Override public void caretUpdate(CaretEvent e) { int dot = textArea.getCaretPosition();
try { int oldOffs = textArea.getCaretPosition(); textArea.setCaretPosition(0); SearchResult res = SearchEngine.replace(textArea, context); textArea.setCaretPosition(textArea.getCaretPosition() + 1);
int dot = textArea.getCaretPosition(); if (dot>0) { Token t = RSyntaxUtilities.getTokenAtOffset(rsta, dot-1);
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { try { int offs = textArea.getCaretPosition(); int endOffs = getWordEnd(textArea, offs); if (select) textArea.moveCaretPosition(endOffs); else textArea.setCaretPosition(endOffs); } catch (BadLocationException ble) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
private RCompoundEdit startCompoundEdit(UndoableEdit edit) { lastOffset = textArea.getCaretPosition(); compoundEdit = new RCompoundEdit(); compoundEdit.addEdit(edit); addEdit(compoundEdit); return compoundEdit; }