/*
* mFrame2.java
*
* Created on 2005年7月4日, 下午1:12
*/
package DialogExample;
/**
*
* @author Administrator
*/
public class mFrame2 extends javax.swing.JFrame {
/** Creates new form mFrame2 */
public mFrame2() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
buttonGroup3 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jPanel1.setBorder(new javax.swing.border.TitledBorder("Tilte Broder"));
jTextField1.setText("jTextField1");
jPanel1.add(jTextField1);
jButton1.setText("jButton1");
jPanel1.add(jButton1);
getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
pack();
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
if(true) {
System.out.println("hello exiting");
// return;
}
//System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new mFrame2().show();
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField1;
// End of variables declaration
}
关键的代码是 setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
private void exitForm(java.awt.event.WindowEvent evt) {
if(true) {
System.out.println("hello exiting");
// return;
}
//System.exit(0);
}
此程序单击“×”之后什么也不做,只是在console中输出"hello exiting"
--------------------next---------------------
阅读(207) | 评论(0) | 转发(0) |