SWT窗体关闭时显示确认对话框

关闭窗体shell 时显示确认对话框: shell.addShellListener(new ShellAdapter() { public void shellClosed(ShellEvent e) { MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL); mb.setText("Confirm Exit"); mb.setMessage("Are you sure you want to exit?"); int rc = mb.open(); e.doit = (rc == SWT.OK); } });

yava /
in categories tagged with