我在命令行应用程序中创建WizardDialog,如下所示
final Shell shell = new Shell(display);
Wizard wiz = new ImportWizard();
WizardDialog dialog = new WizardDialog(shell, wiz);
dialog.create();
dialog.open();此时将显示向导对话框。但它不会显示在任务栏中。我也试过了
shell.setVisible(true);
dialog.open();这使Shell显示在任务栏中,但shell窗口在向导后面可见。
我该如何解决这个问题呢?
发布于 2014-01-17 10:44:33
我能够使用下面的代码片段解决这个问题
Wizard wiz = new ImportWizard();
WizardDialog dialog = new WizardDialog(null, wiz);
dialog.create();
dialog.open();通过在WizardDialog构造函数中将null作为Shell传递。
发布于 2014-01-16 19:26:46
我可能会假设,出现这种行为的原因是WizardDialog类只有一个构造函数来提供Shell,它最终(在Dialog类中)使用SameShellProvider作为外壳提供程序。你需要继承一些东西,在那里你可以传递你自己的IShellProvider,例如TrayDialog (或者其他合适的类)。
https://stackoverflow.com/questions/21159224
复制相似问题