我有一个对话框,我想要从后面的命令处理。但它没有发生。为什么?
selectDialog = new Dialog();
selectDialog.showPacked(BorderLayout.CENTER, false);
selectDialog.setDisposeWhenPointerOutOfBounds(true);
//why doesn't following code dispose dialog box?
Command back = new Command("") {
public void actionPerformed(ActionEvent ev) {
if (selectDialog != null) {
System.out.println("beck");
selectDialog.dispose();
}
}
};
setBackCommand(back);
答案 0 :(得分:0)
而不是:
setBackCommand(back);
使用:
selectDialog.setBackCommand(back);