怎么让WizardDialog能最小化到任务栏,而且不能使用最大化按钮,谢谢。
public class Main {
public static void main(String[] args) {
Display display = new Display();
Rectangle bounds = display.getPrimaryMonitor().getBounds(); Shell shell = new Shell(display);
Rectangle rect = shell.getBounds();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation(x, y);
WizardDialog dlg = new WizardDialog(shell, new pBuildWizard());
WizardDialog.setDefaultImage(new Image(Display.getCurrent(), "pBuild_ICON.jpg"));
dlg.open();
display.dispose();
}
}
public class Main {
public static void main(String[] args) {
Display display = new Display();
Rectangle bounds = display.getPrimaryMonitor().getBounds(); Shell shell = new Shell(display);
Rectangle rect = shell.getBounds();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation(x, y);
WizardDialog dlg = new WizardDialog(shell, new pBuildWizard());
WizardDialog.setDefaultImage(new Image(Display.getCurrent(), "pBuild_ICON.jpg"));
dlg.open();
display.dispose();
}
}
改成: Shell shell = new Shell(display,SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE );
我要是怎么让WizardDialog dlg能最小化到任务栏,而且不能使用最大化按钮,不是shell,上面说的方法还是不能让dlg最小化。
谢谢。
public class TestWizardDialog extends WizardDialog {
public TestWizardDialog (final Shell parentShell, final IWizard newWizard) {
super(parentShell, newWizard);
} @Override
protected void setShellStyle(final int newShellStyle) {
super.setShellStyle(SWT.CLOSE | SWT.MIN | SWT.TITLE | SWT.BORDER
| SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
}然后在你的程序里用这个类就可以了。