日期:2014-05-20 浏览次数:20943 次
public LoginDialog(JDBC jdbc, JFrame frame) {
super(frame, true);
this.jdbc = jdbc;
this.setLayout(null);
initComponent();
this.setSize(300, 250);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
this.setVisible(true);
}
public LoginDialog(JDBC jdbc, JFrame frame) {
super(frame, true);
this.jdbc = jdbc;
this.setLayout(null);
initComponent();
this.setSize(300, 250);
this.setVisible(true);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class LoginDialog extends Dialog {
public LoginDialog(Frame frame) {
super(frame, false);//true,false 切换
try {
this.setLayout(null);
this.setSize(300, 250);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
this.setVisible(true);
}finally {
System.out.println("veryGood");//本来想模拟关掉模态窗口,打印,结果,还没想到好点的办法打印。
}
}
public static void main(String[] args) throws Exception {
new LoginDialog(new Frame());
}
}