为什么在Linux中缺少最大化和最小化选项但在Windows中工作 [英] why maximize and minimize option is missing in linux but working in windows

查看:163
本文介绍了为什么在Linux中缺少最大化和最小化选项但在Windows中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个Java SWT(GUI)程序来仅显示外壳窗口,并在Eclipse中运行它,并且我正在使用Fedora 17操作系统.

I written a Java SWT (GUI) program to just display the shell window and I running it in Eclipse and I am using Fedora 17 operating system.

我正在该窗口中缺少最大化和最小化选项的输出.但是我在Windows 7中进行了尝试,它可以为我提供正确的输出而不会丢失任何内容.

I am getting the output with maximize and minimize option missing in that window. But I tried it in Windows 7 and it gives me the correct output without missing anything.

请任何人告诉我,为什么Fedora 17中缺少它,以及解决该问题的解决方案是什么?

Please anyone tell me that why is it missing in Fedora 17 and what is the solution to correct it?

这是代码:

import org.eclipse.swt.SWT;

import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.Label;

import org.eclipse.swt.widgets.Shell;


public class Example {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display,SWT.MAX|SWT.MIN);
        Label label1 = new Label(shell,SWT.NONE);
        label1.setText("CLEAR IT OUT PLEASE");
        label1.setBounds(50,30,200,30);
        shell.pack ();
        shell.setSize(315,200);
        shell.open ();
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
         }
}

推荐答案

Fedora 17使用GNOME 3.4,如果使用的是GNOME 3,则默认的窗口管理器(gnome shell)没有最小化或最大化图标(我知道,如果您确实遇到了问题,请尝试在发行版上安装gnome-tweak-tool:

Fedora 17 uses GNOME 3.4, and if you are using GNOME 3 the default window manager (gnome shell) doesn't have minimize or maximize icons (I know, it is seriously stupid.) If that is indeed the problem you are having, try installing gnome-tweak-tool on your distro:

https://askubuntu.com /questions/125765/how-do-i-add-minimize-maximize-buttons-to-gnome-shell-windows

如果您了解有关SWT的更多信息,您会发现它使用了本机GUI主机操作系统的库来显示图形元素,因此您将受制于窗口管理器的异想天开,也许您不会使用Swing之类的东西.

If you read more about SWT, you'll see that it uses the native GUI libraries of host OSes to display graphical elements, hence you'll be subject to the whims of the window manager, which perhaps you wouldn't with something like Swing.

这篇关于为什么在Linux中缺少最大化和最小化选项但在Windows中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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