javax.swing.JFrame.getDefaultCloseOperation()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(279)

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

JFrame.getDefaultCloseOperation介绍

暂无

代码示例

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

// Create a frame
JFrame frame = new JFrame();

// Get default close operation
int op = frame.getDefaultCloseOperation(); // HIDE_ON_CLOSE

// Set to exit on close
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

代码示例来源:origin: org.mobicents.ussd/http-simulator

@Override
      public void windowClosing(WindowEvent arg0) {
        if (frmHtppSimulator.getDefaultCloseOperation() == JDialog.DO_NOTHING_ON_CLOSE) {
          JOptionPane.showMessageDialog(getJFrame(), "Before exiting you must close a test window form");
        } else {
//                  if (hostImpl != null) {
//                      hostImpl.quit();
//                  }
        }
      }
    });

代码示例来源:origin: org.mobicents.smsc/smpp-simulator

@Override
      public void windowClosing(WindowEvent arg0) {
        if (frmSmppSimulator.getDefaultCloseOperation() == JDialog.DO_NOTHING_ON_CLOSE) {
          JOptionPane.showMessageDialog(getJFrame(), "Before exiting you must close a test window form");
        } else {
//                    if (hostImpl != null) {
//                        hostImpl.quit();
//                    }
        }
      }
    });

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

public static class UpdateTask implements ActionListener {

  @Override
  public void actionPerformed(ActionEvent ae) {

    Frame[] frames = Frame.getFrames();
    for (Frame frame : frames) {

      if (frame instanceof JFrame) {

        JFrame change = (JFrame) frame;
        System.out.println("Before = " + change.getTitle() + " = " + change.getDefaultCloseOperation());
        ((JFrame)frame).setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        System.out.println("After = " + change.getTitle() + " = " + change.getDefaultCloseOperation());

      }

    }

  }

}

代码示例来源:origin: org.japura/japura-gui

private void backupProperties(JFrame frame) {
 oldDefaultCloseOperation = frame.getDefaultCloseOperation();
 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
 oldWindowListeners = frame.getWindowListeners();
 for (WindowListener listener : oldWindowListeners) {
  frame.removeWindowListener(listener);
 }
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

public static WindowClosingProtocol.WindowClosingMode getNWClosingOperation(final Component c) {
    final JFrame jf = getJFrame(c);
    final int op = (null != jf) ? jf.getDefaultCloseOperation() : WindowConstants.DO_NOTHING_ON_CLOSE ;
    return AWT2NWClosingOperation(op);
  }
}

代码示例来源:origin: com.github.waikato/fcms-widgets

if (frame instanceof JFrame) {
 jframe = (JFrame) frame;
 if (jframe.getDefaultCloseOperation() == JFrame.HIDE_ON_CLOSE)
  jframe.setVisible(false);
 else if (jframe.getDefaultCloseOperation() == JFrame.DISPOSE_ON_CLOSE)
  jframe.dispose();
 else if (jframe.getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE)
  System.exit(0);

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

initComponents();
addWindowListener(new WindowNotifier());
cboDefaultCloseOp.setSelectedIndex(getDefaultCloseOperation());

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

if (frame instanceof JFrame) {
 jframe = (JFrame) frame;
 if (jframe.getDefaultCloseOperation() == JFrame.HIDE_ON_CLOSE)
  jframe.setVisible(false);
 else if (jframe.getDefaultCloseOperation() == JFrame.DISPOSE_ON_CLOSE)
  jframe.dispose();
 else if (jframe.getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE)
  System.exit(0);

代码示例来源:origin: Waikato/weka-trunk

if (frame instanceof JFrame) {
 jframe = (JFrame) frame;
 if (jframe.getDefaultCloseOperation() == JFrame.HIDE_ON_CLOSE)
  jframe.setVisible(false);
 else if (jframe.getDefaultCloseOperation() == JFrame.DISPOSE_ON_CLOSE)
  jframe.dispose();
 else if (jframe.getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE)
  System.exit(0);

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

return ((JFrame) e.getComponent()).getDefaultCloseOperation();

相关文章

JFrame类方法