如何在没有日食的情况下使用SWT?

use*_*754 1 java eclipse user-interface swt widget

我想使用swt制作GUI,但是我不想使用eclipse进行编程。反正有做到这一点。另外,有没有SWT的GUI设计器不是eclipse插件。

Ale*_* K. 5

当然,可以独立于Eclipse-RCP平台使用SWT。您只需要有合适的罐子即可。查看这些示例http://www.eclipse.org/swt/snippets/。例如:

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;

public class Snippet169 {
public static void main (String [] args) {
    Display display = new Display ();
    final Shell shell = new Shell (display);
    shell.setLayout (new FillLayout ());
    Listener listener = new Listener () {
        public void handleEvent (Event e) {
            Control [] children = shell.getChildren ();
            for (int i=0; i<children.length; i++) {
                Control child = children [i];
                if (e.widget != child && child instanceof Button && (child.getStyle () & SWT.TOGGLE) != 0) {
                    ((Button) child).setSelection (false);
                }
            }
            ((Button) e.widget).setSelection (true);
        }
    };
    for (int i=0; i<20; i++) {
        Button button = new Button (shell, SWT.TOGGLE);
        button.setText ("B" + i);
        button.addListener (SWT.Selection, listener);
        if (i == 0) button.setSelection (true);
    }
    shell.pack ();
    shell.open ();
    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
}
Run Code Online (Sandbox Code Playgroud)

此外,SWT设计师并不局限于Eclipse插件,而只是通过google找到合适的插件。Eclipse(但不仅限于Eclipse插件)的SWT设计器示例:http : //www.eclipse.org/windowbuilder/