- 论坛徽章:
- 0
|
一个HelloWorld,用了swt。。。
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
public class HelloWorld {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Label label = new Label(shell, SWT.NONE);
label.setText("Hello, World!");
label.pack();
shell.pack();
shell.open();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
display.dispose();
}
}
在gentoo,sun-jdk-1.5.0.04 sun-jre-bin-1.5.0.04
dev-java/swt-3.2_pre1
编译:
javac -cp /usr/share/swt-3/lib/swt.jar HelloWorld.java
运行命令:
java -cp /usr/share/swt-3/lib/swt.jar:. -Djava.library.path=/usr/lib HelloWorld
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/712/showart_50250.html |
|