简体   繁体   English

Java SWT-在外壳上使用SWT.V_SCROLL时,外壳的标题栏消失

[英]Java SWT - shell's titlebar disappear when using SWT.V_SCROLL on shell

Well, I'm not sure if I'm doing something wrong, but when I use SWT.V_SCROLL on shell, its titlebar disappears. 好吧,我不确定自己是否做错了什么,但是当我在shell上使用SWT.V_SCROLL时,其标题栏消失了。 In addition, shell window cannot be resized or moved. 另外,shell窗口无法调整大小或移动。 I'm using Windows 8.1, Eclipse 4.4 and SWT 4.4 (all are x64 versions). 我正在使用Windows 8.1,Eclipse 4.4和SWT 4.4(均为x64版本)。

    final private static Shell shell = new Shell(SWT.V_SCROLL);

    //shell init
    shell.setSize(850, 900);
    shell.setLocation(200, 10);
    Rectangle shellSize = shell.getBounds();
    shell.setMinimumSize(shellSize.width, shellSize.height);

    FormLayout layout_shell = new FormLayout();
    shell.setLayout(layout_shell);

This is how it looks like: 它是这样的:

http://snag.gy/OzfNv.jpg

When used 'clean' shell: 使用“干净”外壳时:

    final private static Shell shell = new Shell();

http://snag.gy/mEuK2.jpg

Thanks in advance for help! 在此先感谢您的帮助!

If you call new Shell(SWT.V_SCROLL) , the generated shell will only be able to scroll and won't have any decorations and/or resize/move functionality. 如果调用new Shell(SWT.V_SCROLL) ,则生成的外壳将只能滚动,并且将不具有任何装饰和/或调整大小/移动功能。 The default constructor (without parameter) on the other hand internally calls other constructors and sets the style to SHELL_TRIM . 另一方面,默认构造函数(不带参数)在内部调用其他构造函数,并将样式设置为SHELL_TRIM

If you want your application to be scrollable, add a ScrolledComposite as the first child of your Shell . 如果您希望应用程序可滚动,请添加ScrolledComposite作为Shell的第一个孩子。


Note: using new Shell(SWT.SHELL_TRIM | SWT.V_SCROLL) does show a scrollbar, but the content won't actually scroll 注意:使用new Shell(SWT.SHELL_TRIM | SWT.V_SCROLL) 确实会显示一个滚动条,但是内容实际上不会滚动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM