Example usage for javax.swing.text JTextComponent getClass

List of usage examples for javax.swing.text JTextComponent getClass

Introduction

In this page you can find the example usage for javax.swing.text JTextComponent getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:net.sf.jabref.gui.keyboard.EmacsKeyBindings.java

private static void createBackup() {
    Keymap oldBackup = JTextComponent.getKeymap(EmacsKeyBindings.JTCS[0].getClass().getName());
    if (oldBackup != null) {
        // if there is already a backup, do not create a new backup
        return;//from ww w  .  ja  v  a 2s .c o  m
    }

    for (JTextComponent jtc : EmacsKeyBindings.JTCS) {
        Keymap orig = jtc.getKeymap();
        Keymap backup = JTextComponent.addKeymap(jtc.getClass().getName(), null);
        Action[] bound = orig.getBoundActions();
        for (Action aBound : bound) {
            KeyStroke[] strokes = orig.getKeyStrokesForAction(aBound);
            for (KeyStroke stroke : strokes) {
                backup.addActionForKeyStroke(stroke, aBound);
            }
        }
        backup.setDefaultAction(orig.getDefaultAction());
    }
}