SWT Java:如何防止窗口调整大小? [英] SWT Java: How to prevent window from resizing?

查看:361
本文介绍了SWT Java:如何防止窗口调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用窗口大小调整。有什么想法?

I want to disable resizing of window. Any ideas?

推荐答案

您可以使用指定 Shell 样式位两个arg构造函数。默认样式位为 SWT.SHELL_TRIM

You can specify the Shell style bits by using the two-arg constructor. The default style bits are SWT.SHELL_TRIM:

public static final int SHELL_TRIM = CLOSE | TITLE | MIN | MAX | RESIZE;

您实际上想要排除 RESIZE 位。如果您要创建自己的 Shell

You actually want to exclude the RESIZE bit. If you're creating your own Shell:

final Shell shell = new Shell(parentShell, SWT.SHELL_TRIM & (~SWT.RESIZE));

如果你正在扩展对话,你可以通过覆盖 getShellStyle 来影响shell样式位:

If you're extending Dialog, you can influence the shell style bits by overridding getShellStyle:

@Override
protected int getShellStyle()
{
    return super.getShellStyle() & (~SWT.RESIZE);
}

这篇关于SWT Java:如何防止窗口调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆