java.awt.event.WindowListener.windowClosing()方法的使用及代码示例

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

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

WindowListener.windowClosing介绍

[英]Invoked when the user attempts to close the window from the window's system menu. If the program does not explicitly hide or dispose the window while processing this event, the window close operation will be cancelled.
[中]当用户试图从窗口的系统菜单关闭窗口时调用。如果程序在处理此事件时未显式隐藏或处理窗口,则窗口关闭操作将被取消。

代码示例

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

/**
 * Invoked when an internal frame is in the process of being closed. The close operation can be
 * overridden at this point.
 */
public void internalFrameClosing(InternalFrameEvent event) {
  listener.windowClosing(null);
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Invoked when an internal frame is in the process of being closed.
 * The close operation can be overridden at this point.
 */
public void internalFrameClosing(InternalFrameEvent event) {
  listener.windowClosing(null);
}

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Invoked when an internal frame is in the process of being closed.
 * The close operation can be overridden at this point.
 */
public void internalFrameClosing(InternalFrameEvent event) {
  listener.windowClosing(null);
}

代码示例来源:origin: JChemPaint/jchempaint

/**
 * Closes all currently opened JCP instances.
 */
public static void closeAllInstances() {
  int instancesNumber = instances.size();
  for (int i = instancesNumber - 1; i >= 0; i--) {
    JFrame frame = (JFrame) instances.get(i).getTopLevelContainer();
    WindowListener[] wls = (WindowListener[]) (frame
        .getListeners(WindowListener.class));
    wls[0].windowClosing(new WindowEvent(frame,
        WindowEvent.WINDOW_CLOSING));
  }
}

代码示例来源:origin: openstreetmap/osmembrane

@Override
  public void actionPerformed(ActionEvent e) {
    hideWindow();
    for (WindowListener wl : getWindowListeners()) {
      wl.windowClosing(new WindowEvent(ExecutionStateDialog.this,
          WindowEvent.WINDOW_CLOSING));
    }
  }
});

代码示例来源:origin: JChemPaint/jchempaint

/**
   *  Closes the current frame
   */
  public void actionPerformed(ActionEvent e) {
   JFrame jFrame = (JFrame) jcpPanel.getTopLevelContainer();
   WindowListener[] wls = jFrame.getWindowListeners();
   wls[0].windowClosing(new WindowEvent(jFrame, WindowEvent.WINDOW_CLOSING));
  }
}

相关文章