java.awt.Toolkit.getAWTEventListeners()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中java.awt.Toolkit.getAWTEventListeners()方法的一些代码示例,展示了Toolkit.getAWTEventListeners()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolkit.getAWTEventListeners()方法的具体详情如下:
包路径:java.awt.Toolkit
类名称:Toolkit
方法名:getAWTEventListeners

Toolkit.getAWTEventListeners介绍

[英]Returns an array of all the AWTEventListeners registered on this toolkit.

First, if there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.

Listeners can be returned within AWTEventListenerProxy objects, which also contain the event mask for the given listener. Note that listener objects added multiple times appear only once in the returned array.
[中]返回在此工具包上注册的所有AWTEventListener的数组。
首先,如果有一个安全管理器,它的checkPermission方法将被调用,并具有AWTPermission("listenToAllAWTEvents")权限。这可能会导致SecurityException
监听器可以在AWTEventListenerProxy对象中返回,该对象还包含给定监听器的事件掩码。请注意,多次添加的侦听器对象在返回的数组中只出现一次。

代码示例

代码示例来源:origin: joel-costigliola/assertj-swing

private void removePrevious() {
 AWTEventListener[] listeners = toolkit.getAWTEventListeners(EVENT_MASK);
 for (AWTEventListener listener : listeners) {
  if (listener instanceof EmergencyAbortListener) {
   toolkit.removeAWTEventListener(listener);
  }
 }
}

代码示例来源:origin: UISpec4J/UISpec4J

public AWTEventListener[] getAWTEventListeners() {
 return getUnderlyingToolkit().getAWTEventListeners();
}

代码示例来源:origin: UISpec4J/UISpec4J

public AWTEventListener[] getAWTEventListeners(long eventMask) {
 return getUnderlyingToolkit().getAWTEventListeners(eventMask);
}

代码示例来源:origin: stackoverflow.com

public void eventDispatched(AWTEvent event) {
  System.out.println("-----------------------");
  for (AWTEventListener listener : Toolkit.getDefaultToolkit().getAWTEventListeners()) {
    System.out.println(listener);

相关文章