怎么让WizardDialog能最小化到任务栏,而且不能使用最大化按钮

chenhaifeng88888 2009-12-18 08:35:10
怎么让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();
}
}
...全文
104 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenhaifeng88888 2009-12-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 crazylaa 的回复:]
引用 1 楼 islandrabbit 的回复:
只需把: Shell shell = new Shell(display);
改成:  Shell shell = new Shell(display,SWT.DIALOG_TRIM | SWT.MIN  | SWT.RESIZE );


up
[/Quote]

我要是怎么让WizardDialog dlg能最小化到任务栏,而且不能使用最大化按钮,不是shell,上面说的方法还是不能让dlg最小化。
谢谢。
islandrabbit 2009-12-21
  • 打赏
  • 举报
回复
有一阵没用过WizardDialog了,应该是这样:

要写个新的类TestWizardDialog:


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());
}

然后在你的程序里用这个类就可以了。
chenhaifeng88888 2009-12-21
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 islandrabbit 的回复:]
那么再试试这个:

Shell shell = new Shell(display,SWT.MODELESS | SWT.DIALOG_TRIM | SWT.MIN  | SWT.RESIZE );
[/Quote]

不行啊。
islandrabbit 2009-12-21
  • 打赏
  • 举报
回复
那么再试试这个:

Shell shell = new Shell(display,SWT.MODELESS | SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE );
chenhaifeng88888 2009-12-21
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 islandrabbit 的回复:]
引用 3 楼 chenhaifeng88888 的回复:
引用 2 楼 crazylaa 的回复:
引用 1 楼 islandrabbit 的回复:
只需把: Shell shell = new Shell(display);
改成:  Shell shell = new Shell(display,SWT.DIALOG_TRIM | SWT.MIN  | SWT.RESIZE );


up


我要是怎么让WizardDialog dlg能最小化到任务栏,而且不能使用最大化按钮,不是shell,上面说的方法还是不能让dlg最小化。
谢谢。

你试了吗?
[/Quote]

我试了啊。
islandrabbit 2009-12-21
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 chenhaifeng88888 的回复:]
引用 2 楼 crazylaa 的回复:
引用 1 楼 islandrabbit 的回复:
只需把: Shell shell = new Shell(display);
改成:  Shell shell = new Shell(display,SWT.DIALOG_TRIM | SWT.MIN  | SWT.RESIZE );


up


我要是怎么让WizardDialog dlg能最小化到任务栏,而且不能使用最大化按钮,不是shell,上面说的方法还是不能让dlg最小化。
谢谢。
[/Quote]
你试了吗?
crazylaa 2009-12-19
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 islandrabbit 的回复:]
只需把: Shell shell = new Shell(display);
改成:  Shell shell = new Shell(display,SWT.DIALOG_TRIM | SWT.MIN  | SWT.RESIZE );

[/Quote]
up
islandrabbit 2009-12-18
  • 打赏
  • 举报
回复
只需把: Shell shell = new Shell(display);
改成:  Shell shell = new Shell(display,SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE );

62,634

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧