使用 Albireo,很容易看到如何从 SWT 显示 Swing 对话框:
private AwtEnvironment awtEnv = AwtEnvironment.getInstance(Display.getCurrent);
...
// call from SWT thread
void showSwingMessageDialog(String msg) {
awtEnv.invokeAndBlockSwt(new Runnable() {
public void run() {
Frame parentFrame = awtEnv.createDialogParentFrame();
JOptionPane.showMessageDialog(parentFrame, msg);
}
}
}
我想从 AWT 线程显示一个 SWT 对话框,即
// call from AWT thread
void showSWTMessageDialog(String msg) {
???
}