任何人都可以用java和gtk给出一个简单的hello world示例 我所知道的是如何使用带有awt的swing工具包
答案 0 :(得分:1)
来自http://www.linuxjournal.com/article/8111?page=0,1
public class ExampleGNOME {
private LibGlade libglade;
private static final String GLADE_FILE =
"ExampleGNOME.glade";
public ExampleGNOME () throws IOException {
libglade = new LibGlade(GLADE_FILE, this);
}
public void on_noButton_released(GtkEvent event) {
Gtk.mainQuit();
System.exit(1);
}
public void on_yesButton_released(GtkEvent event) {
Gtk.mainQuit();
System.exit(0);
}
public static void main(String args[]) {
ExampleGNOME gui;
Gtk.init(args);
try {
gui = new ExampleGNOME();
} catch (IOException e) {
System.err.println(e);
System.exit(1);
}
Gtk.main();
}
}