java类java.awt.event.WindowListener的实例源码

WindowClosingEventSubject.java 文件源码 项目:reactive-stream-swing 阅读 22 收藏 0 点赞 0 评论 0
@Override
protected WindowListener onSubscribe(final Observer<? super WindowEvent> observer) {
    LOG.trace("onSubscribe(): {}", observer);

    checkNotNull(observer, "observer");

    final WindowListener listener = new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            LOG.trace("windowClosing(): {}", e);
            onNext(e);
        }
    };

    window.addWindowListener(listener);

    return listener;
}
SwingEngine.java 文件源码 项目:msInspect 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Displays the GUI during a RAD session. If the root component is neither a JFrame nor a JDialog, the a JFrame is
 * instantiated and the root is added into the new frames contentpane.
 */
public void test() {
  WindowListener wl = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
      super.windowClosing(e);
      System.exit(0);
    }
  };
  if (root != null) {
    if (JFrame.class.isAssignableFrom(root.getClass())
            || JDialog.class.isAssignableFrom(root.getClass())) {
      ((Window) root).addWindowListener(wl);
      root.setVisible(true);
    } else {
      JFrame jf = new JFrame("SwiXml Test");
      jf.getContentPane().add(root);
      jf.pack();
      jf.addWindowListener(wl);
      jf.setVisible(true);
    }
  }
}
Launcher.java 文件源码 项目:osp 阅读 29 收藏 0 点赞 0 评论 0
private void exitCurrentApps() {
  final Frame[] prevFrames = Frame.getFrames();
  for(int i = 0, n = prevFrames.length; i<n; i++) {
    if(existingFrames.contains(prevFrames[i])) {
      continue; // don't mess with pre-existing frames such as the applet plugin
    }
    if(!(prevFrames[i] instanceof LauncherFrame)) {
      WindowListener[] listeners = prevFrames[i].getWindowListeners();
      for(int j = 0; j<listeners.length; j++) {
        listeners[j].windowClosing(null);
      }
      if(prevFrames[i].isVisible()) {
        prevFrames[i].dispose();
      }
    }
  }
}
ImageToZxSpec.java 文件源码 项目:imagetozxspec 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Creates a window listener that shuts down the app gracefully
 * 
 * @return the window listener
 */
private WindowListener createWindowListener() {
    // Override the window close listener to clear up resources 
    return new WindowAdapter() {
            public void windowClosing(WindowEvent w) {
                shutdown();
            }
    };
}
WindowOperator.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Maps {@code Window.addWindowListener(WindowListener)} through queue
 */
public void addWindowListener(final WindowListener windowListener) {
    runMapping(new MapVoidAction("addWindowListener") {
        @Override
        public void map() {
            ((Window) getSource()).addWindowListener(windowListener);
        }
    });
}
WindowOperator.java 文件源码 项目:openjdk-jdk10 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Maps {@code Window.removeWindowListener(WindowListener)} through queue
 */
public void removeWindowListener(final WindowListener windowListener) {
    runMapping(new MapVoidAction("removeWindowListener") {
        @Override
        public void map() {
            ((Window) getSource()).removeWindowListener(windowListener);
        }
    });
}
ChartPanel.java 文件源码 项目:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud 阅读 35 收藏 0 点赞 0 评论 0
public static void viewGraph(int one, int two) {
    JFrame f = new JFrame();
    f.setSize(500, 400);
    f
            .setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    f.setTitle("Group Signature Graph");
    double[] values = new double[2];
    String[] names = new String[2];
    values[0] = one;
    names[0] = "Existed System";

    values[1] = two;
    names[1] = "Praposed System";

    f.getContentPane()
            .add(
                    new ChartPanel(values, names,
                            "Group Signature Genereted Graph"));

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    f.addWindowListener(wndCloser);
    f.setVisible(true);
}
WindowOperator.java 文件源码 项目:openjdk9 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Maps {@code Window.addWindowListener(WindowListener)} through queue
 */
public void addWindowListener(final WindowListener windowListener) {
    runMapping(new MapVoidAction("addWindowListener") {
        @Override
        public void map() {
            ((Window) getSource()).addWindowListener(windowListener);
        }
    });
}
WindowOperator.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Maps {@code Window.removeWindowListener(WindowListener)} through queue
 */
public void removeWindowListener(final WindowListener windowListener) {
    runMapping(new MapVoidAction("removeWindowListener") {
        @Override
        public void map() {
            ((Window) getSource()).removeWindowListener(windowListener);
        }
    });
}
SwingUIUtils.java 文件源码 项目:hiervis 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Creates and registers a {@link WindowListener} to {@code window}, which executes the callback expression.
 * 
 * @param window
 *            the window whose closing will cause the callback to be executed.
 * @param callback
 *            the callback to execute when the window closes.
 * @return the created listener
 */
public static WindowListener addCloseCallback( Window window, Runnable callback )
{
    WindowListener listener = new WindowAdapter() {
        @Override
        public void windowClosing( WindowEvent e )
        {
            callback.run();
        }
    };
    window.addWindowListener( listener );
    return listener;
}


问题


面经


文章

微信
公众号

扫码关注公众号