比如;我在程序中,如何让//1建立的对话框在关闭后,才执行//2?现在这个程序在//1对话框弹出后.//2马上就执行了,不想这样 public JButton getAddModuleButton() {
if (null == addModuleButton) {
addModuleButton = new JButton("添加新采集点");
addModuleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) {
AddNewModuleDialog dlg = new AddNewModuleDialog(
ModuleManagementDialog.this);//1
bindModuleTable();//2
} });
}
return addModuleButton;
}
if (null == addModuleButton) {
addModuleButton = new JButton("添加新采集点");
addModuleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) {
AddNewModuleDialog dlg = new AddNewModuleDialog(
ModuleManagementDialog.this);//1
bindModuleTable();//2
} });
}
return addModuleButton;
}
dlg.setModal(true);
public AddNewModuleDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
...
}
调用方法改为
AddNewModuleDialog dialog = new AddNewModuleDialog(this, true);