[Java-gnome-developer] Problem running glade program
Brought to you by:
afcowie
From: Abcdefg <ab...@so...> - 2004-12-17 18:04:34
|
Hi, I'm trying to run this java/glade program but it doesn't work http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/GladeGUIS Where can I find documentation for java/glade/gtk? In the documentation page are a lot of dead links: http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/HintsAndTips so this isn't useful.. Here's what I tried: copied the glade file and java file and putted them in the files SimpleGladeExample.java and example1.glade and removed the // lines then compile (javac SimpleGladeExample.java or gcj --main=SimpleGladeExample SimpleGladeExample.java) The errors are: SimpleGladeExample.java:19: cannot resolve symbol symbol : variable glade location: class SimpleGladeExample glade = new LibGlade(inputStream, this, gladeRoot); ^ SimpleGladeExample.java:33: non-static variable PROGRAM_NAME cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:33: non-static variable PROGRAM_VERSION cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:35: cannot resolve symbol symbol : variable Gtk location: class SimpleGladeExample Gtk.main(); ^ 4 errors So in the code: import java.io.*; import org.gnu.glade.*; import org.gnu.gnome.*; public class SimpleGladeExample { private final String PROGRAM_NAME = "Glade Example"; private final String PROGRAM_VERSION = "1.0"; private final String gladeFile = "example1.glade"; private final String gladeRoot = "glade_root_element"; private LibGlade libGlade; public SimpleGladeExample() { try { InputStream inputStream = getClass().getResourceAsStream(gladeFile); glade = new LibGlade(inputStream, this, gladeRoot); } catch (GladeXMLException e) { e.printStackTrace(); System.exit(-1); } catch (FileNotFoundException e) { e.printStackTrace(); System.exit(-1); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } } public static final void main(String[] args) { Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); SimpleGladeExample example = new SimpleGladeExample(); Gtk.main(); } } I changed private LibGlade libGlade; to private LibGlade glade; ..... But then when I compile tihs are the errors: SimpleGladeExample.java:33: non-static variable PROGRAM_NAME cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:33: non-static variable PROGRAM_VERSION cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:35: cannot resolve symbol symbol : variable Gtk location: class SimpleGladeExample Gtk.main(); ^ 3 errors Thanks for your help in advance, David |