if(newFrame==null){
newFrame=new Frame();
newFrame.show();
newFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
e.getWindow().dispose();
}
}
);
}else{
newFrame.setTitle("new...");//do something here
newFrame.show();
}
newFrame=new Frame();
newFrame.show();
newFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
e.getWindow().dispose();
}
}
);
}else{
newFrame.setTitle("new...");//do something here
newFrame.show();
}
if(newFrame==null)
newFrame = new AddNewFrame("新增條碼類型");newFrame.setVisible(true);然后关闭的时候,newFrame.setVisible(false)
楼上的chanceqw()说得对。通常都这么写。