This example demonstrates how to list all the actions in a component.

    ActionMap map = component.getActionMap();

    // List actions in the component
list(map, map.keys()); // List actions in the component and in all parent action maps
list(map, map.allKeys()); public static void list(ActionMap map, Object[] actionKeys) {
if (actionKeys == null) {
return;
}
for (int i=0; i<actionKeys.length; i++) {
// Get the action bound to this action key
while (map.get(actionKeys[i]) == null) {
map = map.getParent();
}
Action action = (Action)map.get(actionKeys[i]);
}
}

A text component not only has an action map with actions, it also has keymaps with actions. Moreover, every keymap has a default action to handle any typed character key events not handled by any input map or keymap. The following code retrieves actions from these objects:

    // List the actions in the keymaps
if (component instanceof JTextComponent) {
JTextComponent textComp = (JTextComponent)component;
Keymap keymap = textComp.getKeymap(); while (keymap != null) {
// Get actions in the keymap
Action[] actions = keymap.getBoundActions();
for (int i=0; i<actions.length; i++) {
Action action = actions[i];
} // Get the default action in the keymap
Action defaultAction = keymap.getDefaultAction();
keymap = keymap.getResolveParent();
}
}
Related Examples

e856. 列出一个组件的所有事件的更多相关文章

  1. Vue中调用另一个组件中自定义事件

    之前在一个场景中,遇到组件需要调用父组件中的方法tableInit(),字组件调用父组件常用的有三种方法,具体参考:https://www.cnblogs.com/jin-zhe/p/9523782. ...

  2. Vue一个案例引发的动态组件与全局事件绑定总结

    最近在自学 Vue 也了解了一些基本用法,也记录了一些笔记有兴趣的朋友可以去查看我的其他文章,技术这东西真的不能光靠看,看是没有的,你必须要动手实践,只有在实战项目中才能发现问题,才能发现我们没有掌握 ...

  3. 微信小程序开发03-这是一个组件

    编写组件 基本结构 接上文:微信小程序开发02-小程序基本介绍 我们今天先来实现这个弹出层: 之前这个组件是一个容器类组件,弹出层可设置载入的html结构,然后再设置各种事件即可,这种组件有一个特点: ...

  4. bootstrap中的dropdown组件扩展hover事件

    bootstrap的下拉组件,需要点击click时,方可展示下拉列表.因此对于喜欢简单少操作的大家来说,点击一下多少带来不便,因此,引入hover监听,鼠标经过自动展示下拉框.其实在bootstrap ...

  5. vue子组件的自定义事件

    父子组件的信息传递无碍就是父组件给子组件传值(props和$attrs)和父组件触发子组件的事件($emit) 之前已经谈过了父组件给子组件传值了,现在来说说父组件触发子组件的自定义事件吧-- 实际上 ...

  6. vuejs组件交互 - 02 - 事件中心管理组件间的通信

    事件中心 这个可以是一个空的全局的Vue实例,其他的组件利用这个实例emit和on自定义事件,这样组件定义了自己的事件处理方法. import Vue from 'Vue' window.eventH ...

  7. vue如何正确销毁当前组件的scroll事件?

    将方法写出来,销毁在beforeDestroy写. mounted(){ window.addEventListener("scroll",this.handleFun), }, ...

  8. Vue.js教程--基础(实例 模版语法template computed, watch v-if, v-show v-for, 一个组件的v-for.)

    官网:https://cn.vuejs.org/v2/guide/index.html Vue.js 的核心是一个允许采用简洁的模板语法来声明式地将数据渲染进 DOM 的系统. 视频教程:https: ...

  9. NO.08--VUE之自定义组件添加原生事件

    前几篇给大家分享了我的业余的“薅羊毛”的经历,回归正题,讲回vue吧: 许多vue新手在工作开发中会遇到一个问题,直接使用 button 添加原生事件是没有问题的,但是使用自定义组件添加原生事件时,就 ...

随机推荐

  1. PC-Lint概念与基本操作

    1.   PC-Lint工具介绍 PC-Lint for C/C++是由Gimpel软件公司于1985年开发的代码静态分析工具,它能有效地发现程序语法错误.潜在的错误隐患.不合理的编程习惯等. C语言 ...

  2. [Windows Azure] How to Monitor Cloud Services

    How to Monitor Cloud Services To use this feature and other new Windows Azure capabilities, sign up ...

  3. curl传输文件实例

    curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: appli ...

  4. MATLAB中-27开3次方得不到-3的原因

    原代码: y=@(x) x.^(/); 运行结果: >> y(-27) ans = 1.5000 + 2.5981i 原因: 用(-8)^(1/3)时,matlab其实是调用C = pow ...

  5. 在Mac系统下用STS搭建一个Spring MVC项目

    [本文出自天外归云的博客园] 从STS的下载到空项目的搭建 1. 下载STS,下载解压缩后点击sts-bundle文件夹中的STS文件启动ide: 2. 创建Spring MVC项目:File-> ...

  6. csu1356 :判断一个环是否为奇数环

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1356 题意:给出一个起始点,一些边,有人从这个起始点开始随意走,问在某一个时候,它是否可以处于任意 ...

  7. spring集成RabbitMQ配置文件详解(生产者和消费者)

    1,首先引入配置文件org.springframework.amqp,如下: <dependency> <groupId>org.springframework.amqp< ...

  8. Android 聊天功能

    记录一个聊天功能代码,以后有时间再分析吧. GIt的地址:https://github.com/Maxi-Mao/ChatDemo 链接:https://pan.baidu.com/s/1NaXEkT ...

  9. Android ListView的使用(三)

    前两节关于ListView的,已经使用了ArrayAdapter,SimpleAdapter了,两个比较基本的适配器 这里来用一个用的最多的一个适配器BaseAdapter. 还是先上效果图.大概和微 ...

  10. Eval与DataBinder.Eval的区别

    DataBinder.Eval的基本格式 DataBinder.Eval(Container.DataItem,"XXX","{0}") <%# Data ...