我編寫了一個Java SWT(GUI)程序來顯示shell窗口,我在Eclipse中運行它,我使用的是Fedora 17操作系統。爲什麼最大化和最小化選項缺失在Linux中,但在Windows中工作
我得到的輸出與最大化和最小化選項缺失在該窗口中。但我在Windows 7中試過了,它給了我正確的輸出而不會丟失任何東西。
請任何人都告訴我,爲什麼它在Fedora 17中缺失以及解決方法是什麼?
這是代碼:
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();
}
}