A text component has an action map with actions and keymaps with actions : Actions « Swing JFC « Java






A text component has an action map with actions and keymaps with actions

   


import javax.swing.Action;
import javax.swing.JTextField;
import javax.swing.text.JTextComponent;
import javax.swing.text.Keymap;

public class Main {
  public static void main(String[] argv) throws Exception {
    JTextComponent component = new JTextField();
    if (component instanceof JTextComponent) {
      JTextComponent textComp = (JTextComponent) component;
      Keymap keymap = textComp.getKeymap();

      while (keymap != null) {
        Action[] actions = keymap.getBoundActions();
        for (int i = 0; i < actions.length; i++) {
          Action action = actions[i];
        }
        Action defaultAction = keymap.getDefaultAction();
        keymap = keymap.getResolveParent();
      }
    }
  }
}

   
    
    
  








Related examples in the same category

1.Action DemoAction Demo
2.Creating an Action
3.Enabling an Action
4.UseActions: MenuUseActions: Menu
5.Action events are fired by subclasses of AbstractButton and includes buttons, checkboxes, and menus.
6.Listing the Actions in a Component
7.Sharing an InputMap or an ActionMap Between Two Components
8.Apply special filter to a JTextField
9.Listing the Key Bindings in a Component
10.extends AbstractAction to create your won actionextends AbstractAction to create your won action