Source Code : Listing the Key Bindings in a JTextComponent Keymap

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Listing the Key Bindings in a JTextComponent Keymap

  
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

import javax.swing.Action;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
import javax.swing.text.Keymap;

public class Main {
  public static void main(String[] argv) throws Exception {
    JTextArea component = new JTextArea();
    Keymap map = component.getKeymap();

    while (map != null) {
      KeyStroke[] keys = map.getBoundKeyStrokes();

      for (int i = 0; i < keys.length; i++) {
        System.out.println(keys[i].getKeyChar());        
        Action action = (Action) map.getAction(keys[i]);
        System.out.println(action);
      }
      Action defAction = map.getDefaultAction();
      System.out.println(defAction);
      map = map.getResolveParent();
    }
  }

}

   
    
  

Thank with us