@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (select) { textArea.moveCaretPosition(0); } else { textArea.setCaretPosition(0); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { textArea.setCaretPosition(textArea.getCaretPosition()); }
@Override public void mousePressed(MouseEvent e) { if (textArea==null) { return; } if (e.getButton()==MouseEvent.BUTTON1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(pos); } mouseDragStartOffset = pos; } else { mouseDragStartOffset = -1; } }
@Override public void mouseDragged(MouseEvent e) { if (mouseDragStartOffset>-1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(mouseDragStartOffset); textArea.moveCaretPosition(pos); } } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Document doc = textArea.getDocument(); textArea.setCaretPosition(0); textArea.moveCaretPosition(doc.getLength()); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { int dot = getVisibleEnd(textArea); if (select) { textArea.moveCaretPosition(dot); } else { textArea.setCaretPosition(dot); } }
@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); } }
@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); } }
textArea.setCaretPosition(selectedIndex);
textArea.setCaretPosition(offs);
textArea.setCaretPosition(newIndex);
@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); } }
textArea.setCaretPosition(offs);
textArea.setCaretPosition(0); SearchResult res = SearchEngine.replace(textArea, context); textArea.setCaretPosition(textArea.getCaretPosition() + 1); textArea.setCaretPosition(oldOffs); lastFound = new SearchResult();
textArea.setCaretPosition(newPos);
textArea.setCaretPosition(offs);
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (select) { textArea.moveCaretPosition(0); } else { textArea.setCaretPosition(0); } }
dot += length; textArea.setCaretPosition(dot);
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Document doc = textArea.getDocument(); textArea.setCaretPosition(0); textArea.moveCaretPosition(doc.getLength()); }
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); } }