java.awt.Window.getWindowListeners()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(154)

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

Window.getWindowListeners介绍

[英]Returns an array of all the window listeners registered on this window.
[中]返回在此窗口上注册的所有窗口侦听器的数组。

代码示例

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

Window window = SwingUtilities.getWindowAncestor(this);
window.setVisible( false );
  // OR
window.dispose();
  // OR
WindowListener[] windowListeners = window.getWindowListeners();
windowListeners[0].windowClosing( null );

代码示例来源:origin: de.sciss/scisslib

public static void remove( AbstractWindow.Listener l, AbstractWindow w )
  {
    final Window w2 = (Window) w.getWindow();
//        final WindowListenerWrapper wlw = (WindowListenerWrapper) mapListeners.remove( w );
//        w2.removeWindowListener( wlw );

    final WindowListener[] coll = w2.getWindowListeners();
    WindowListenerWrapper wlw;
    for( int i = 0; i < coll.length; i++ ) {
      if( coll[ i ] instanceof WindowListenerWrapper ) {
        wlw = (WindowListenerWrapper) coll[ i ];
        if( wlw.l == l ) {
          w2.removeWindowListener( wlw );
          return;
        }
      }
    }
    throw new IllegalArgumentException( "Listener was not registered " + l );
  }

代码示例来源:origin: eu.mihosoft.vrl/vrl

public static void activateEventFilter(Canvas canvas,
    Container... containers) {
  notifyEnableDisableAWTEventListeners(true);
  if (window != null) {
    throw new IllegalStateException(
        "Please deactivate previous filter first!");
  }
  synchronized (eventFilter) {
    try {
      window = (Window) canvas.getTopLevelParent();
      eventFilter.addContainers(containers);
      windowListeners = window.getWindowListeners();
      for (WindowListener l : window.getWindowListeners()) {
        window.removeWindowListener(l);
      }
    } catch (Exception ex) {
      throw new IllegalStateException(
          "Please attach the canvas to a window first!");
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

Window window = SwingUtilities.getWindowAncestor(jp);
if (window != null) {
  WindowListener wl[] = window.getWindowListeners();
  boolean doAdd = true;
  for (int i = 0; i < wl.length; i++) {

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

final WindowListener[] listeners = parentWindow.getWindowListeners();
for (int x = 0; x != listeners.length; x++) {
  if (listeners[x] instanceof J42WindowAdapter) {

相关文章

Window类方法