Example usage for javax.swing JTextPane getCaretPosition

List of usage examples for javax.swing JTextPane getCaretPosition

Introduction

In this page you can find the example usage for javax.swing JTextPane getCaretPosition.

Prototype

@Transient
public int getCaretPosition() 

Source Link

Document

Returns the position of the text insertion caret for the text component.

Usage

From source file:de.codesourcery.jasm16.ide.ui.views.SourceEditorView.java

@Override
protected final void setupKeyBindingsHook(final JTextPane editor) {
    // 'Rename' action 
    addKeyBinding(editor, KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.ALT_MASK | Event.SHIFT_MASK),
            new AbstractAction() {
                @Override/*w  w  w  . j  a  v  a 2  s  .  c  o  m*/
                public void actionPerformed(ActionEvent e) {
                    maybeRenameLabel(editor.getCaretPosition());
                }
            });
}