Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JTree;
import javax.swing.KeyStroke;

public class Main {
    public static void main(String[] args) {
        JTree tree = new JTree();
        InputMap inputMap = tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        KeyStroke[] keyStrokes = inputMap.allKeys();
        for (KeyStroke keyStroke : keyStrokes) {
            Object actionCommand = inputMap.get(keyStroke);
            System.out.println("keyStroke = " + keyStroke);
            System.out.println("actionCommand = " + actionCommand);
        }
    }
}