GUI を作成するために swt を使用したいのですが、プログラミングに eclipse を使用したくありません。とにかくこれを行うことはありますか。また、Eclipse プラグインではない swt の GUI デザイナーはいますか。
3094 次
3 に答える
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 ();
}
}
また、SWT 設計者は Eclipse プラグインに縛られているわけではありません。Google で適切なプラグインを見つけてください。Eclipse 用の SWT デザイナーの例 (Eclipse プラグインだけでなく): http://www.eclipse.org/windowbuilder/
于 2012-09-18T13:43:36.970 に答える
0
コンピューターに Eclipse をインストールする必要がありますが、SWT JAR ファイルを Eclipse から他のエディターのクラスパスにコピーできます。
Eclipse 以外の SWT GUI 設計者はいないと思います。
于 2012-09-18T13:39:42.477 に答える