Thread: [Java-gnome-developer] error defining signals with glade
Brought to you by:
afcowie
From: <ga...@cw...> - 2005-05-27 20:58:54
|
hiya, i am trying to write a simple app using java-gnome and glade, but i receive an error whenever i try to define a signal for a button in glade. the error says: java.lang.reflect.InvocationTargetException: ListenerDelegate.create failure i receive this with sun's javavm 1.5 and gij-4, and i receive this for each signal i have defined... anyway, i am on ubuntu hoary, versions libgtk2-java/libglade-java: 2.8.3-2 Sourcecode: public class HotplugManager { LibGlade glade; public HotplugManager() throws GladeXMLException, FileNotFoundException, IOException { glade = new LibGlade("data/hotplugmanager.glade", this); } public static void main(String[] args) { HotplugManager hotplugman; Gtk.init(args); try { hotplugman = new HotplugManager(); } catch(Exception e) { e.printStackTrace(); } Gtk.main(); } } as you can see, i am not trying to catch the signal it is only defined in the glade file: <widget class="GtkButton" id="button_execute"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-execute</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="on_button_execute_clicked" last_modification_time="Fri, 27 May 2005 20:56:57 GMT"/> </widget> does anyone have any ideas? thanks in advance cheers gaboro |
From: Keith I. <ke...@ke...> - 2005-05-27 21:20:00
|
On Fri, 2005-05-27 at 22:58 +0200, Ol=C3=A1h G=C3=A1bor wrote: > hiya, > i am trying to write a simple app using java-gnome and glade, but i > receive an error whenever i try to define a signal for a button in > glade. Do you think it's related to: http://bugzilla.gnome.org/show_bug.cgi?id=3D305620 which I posted today? Seems that only some of the signals have the problem, or is it all of them in your experience? Keith > the error says: > java.lang.reflect.InvocationTargetException: ListenerDelegate.create > failure >=20 > i receive this with sun's javavm 1.5 and gij-4, and i receive this for > each signal i have defined... >=20 > anyway, i am on ubuntu hoary, versions libgtk2-java/libglade-java: > 2.8.3-2 >=20 > Sourcecode: >=20 > public class HotplugManager { >=20 > LibGlade glade; > =09 > public HotplugManager() throws GladeXMLException,=20 > FileNotFoundException,=20 > IOException { > glade =3D new LibGlade("data/hotplugmanager.glade", this); > } > =09 > public static void main(String[] args) { > =09 > HotplugManager hotplugman; > =09 > Gtk.init(args); > try { > hotplugman =3D new HotplugManager(); > } catch(Exception e) { > e.printStackTrace(); > } > Gtk.main(); > =09 > } > } >=20 > as you can see, i am not trying to catch the signal it is only defined > in the glade file:=20 > <widget class=3D"GtkButton" id=3D"button_execute"> > <property name=3D"visible">True</property> > <property name=3D"can_default">True</property> > <property name=3D"can_focus">True</property> > <property name=3D"label">gtk-execute</property> > <property name=3D"use_stock">True</property> > <property name=3D"relief">GTK_RELIEF_NORMAL</property> > <property name=3D"focus_on_click">True</property> > <signal name=3D"clicked" handler=3D"on_button_execute_clicked" > last_modification_time=3D"Fri, 27 May 2005 20:56:57 GMT"/> > </widget> >=20 > does anyone have any ideas?=20 > thanks in advance > cheers > gaboro >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Yahoo. > Introducing Yahoo! Search Developer Network - Create apps using Yahoo! > Search APIs Find out how you can build Yahoo! directly into your own > Applications - visit http://developer.yahoo.net/?fr=3Doffad-ysdn-ostg-q= 22005 > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Andrew C. <an...@op...> - 2005-05-28 05:24:55
|
On Fri, 2005-27-05 at 14:19 -0700, Keith Irwin wrote: > On Fri, 2005-05-27 at 22:58 +0200, Oláh Gábor wrote: > > i am trying to write a simple app using java-gnome and glade, but i > > receive an error whenever i try to define a signal for a button in > > glade. While signal autoconnection from LibGlade works in many circumstances, you're going to have problems when you try to connect signals with complex prototypes. So, frankly, if you're working in java-gnome, I would recommend you use the WhateverWidget whatever = (WhateverWidgit) glade.getWidget("whatever"); ... whatever.addListener(new WhateverListener() { public void whateverEvent(WhateverEvent event) { // your code here } }); construct that is familiar from other Java graphical user interface toolkits. Personally, I find that whole thing just a little ugly, but I have to admit that having done both ways, I find that the Listener/Event way provides much greater control over the events, especially in terms of getting to the details of the event. So that's what I recommend. [Eclipse makes this dead easy, by the way] AfC Calgary -- Andrew Frederick Cowie Technology strategy, managing change, establishing procedures, and executing successful upgrades to mission critical business infrastructure. http://www.operationaldynamics.com/ Sydney New York Toronto London |
From: Jeff M. <ku...@gm...> - 2005-05-27 22:51:09
|
On 5/27/05, Ol=E1h G=E1bor <ga...@cw...> wrote: > the error says: > java.lang.reflect.InvocationTargetException: ListenerDelegate.create > failure The problem here is that you have defined a callback=20 (on_button_execute_clicked) but this method doesn't exist in your example. This is not a Java-GNOME bug. If you add this method you will see that it works fine. >=20 > i receive this with sun's javavm 1.5 and gij-4, and i receive this for > each signal i have defined... >=20 > anyway, i am on ubuntu hoary, versions libgtk2-java/libglade-java: > 2.8.3-2 >=20 > Sourcecode: >=20 > public class HotplugManager { >=20 > LibGlade glade; >=20 > public HotplugManager() throws GladeXMLException, > FileNotFoundException, > IOException { > glade =3D new LibGlade("data/hotplugmanager.glade", this)= ; > } >=20 > public static void main(String[] args) { >=20 > HotplugManager hotplugman; >=20 > Gtk.init(args); > try { > hotplugman =3D new HotplugManager(); > } catch(Exception e) { > e.printStackTrace(); > } > Gtk.main(); >=20 > } > } >=20 > as you can see, i am not trying to catch the signal it is only defined > in the glade file: > <widget class=3D"GtkButton" id=3D"button_execute"> > <property name=3D"visible">True</property> > <property name=3D"can_default">True</property> > <property name=3D"can_focus">True</property> > <property name=3D"label">gtk-execute</property> > <property name=3D"use_stock">True</property> > <property name=3D"relief">GTK_RELIEF_NORMAL</property> > <property name=3D"focus_on_click">True</property> > <signal name=3D"clicked" handler=3D"on_button_execute_c= licked" > last_modification_time=3D"Fri, 27 May 2005 20:56:57 GMT"/> > </widget> >=20 > does anyone have any ideas? > thanks in advance > cheers > gaboro >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Yahoo. > Introducing Yahoo! Search Developer Network - Create apps using Yahoo! > Search APIs Find out how you can build Yahoo! directly into your own > Applications - visit http://developer.yahoo.net/?fr=3Doffad-ysdn-ostg-q22= 005 > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer >=20 --=20 Jeffrey Morgan "The highest reward for a man's toil is not what he gets for it, but what he becomes by it" - Jon Ruskin |
From: Tomasz M. <tmi...@co...> - 2005-05-28 19:00:43
|
Dnia 27-05-2005, pią o godzinie 18:51 -0400, Jeff Morgan napisał(a): > ailure > > The problem here is that you have defined a callback > (on_button_execute_clicked) but this method doesn't exist > in your example. This is not a Java-GNOME bug. If you > add this method you will see that it works fine. i'm new to java-gnome and I had the same problem. so forgive me my (maybe lame) question but where this method should be implemented? in which class? -- t.m. Tomasz Mielnik |
From: <ga...@cw...> - 2005-05-28 20:16:57
|
hiya, 2005-05-27, p keltez=C3=A9ssel 18.51-kor Jeff Morgan ezt =C3=ADrta: > On 5/27/05, Ol=C3=A1h G=C3=A1bor <ga...@cw...> wrote: > > the error says: > > java.lang.reflect.InvocationTargetException: ListenerDelegate.create > > failure >=20 > The problem here is that you have defined a callback=20 > (on_button_execute_clicked) but this method doesn't exist > in your example. This is not a Java-GNOME bug. If you > add this method you will see that it works fine. thanks for the comment, but defining the method does no difference - i get the same error... short example:=20 package org.testing; import java.io.FileNotFoundException; import java.io.IOException; import org.gnu.glade.GladeXMLException; import org.gnu.glade.LibGlade; import org.gnu.gtk.Gtk; public class HotplugManager { LibGlade glade; =09 public HotplugManager() throws GladeXMLException, =20 FileNotFoundException,=20 IOException { glade =3D new LibGlade("test.glade", this); } =09 public int on_button1_clicked() { System.out.println("pressed"); return 0; }=09 =09 public static void main(String[] args) { =09 HotplugManager hotplugman;=09 =09 Gtk.init(args); try { hotplugman =3D new HotplugManager(); } catch(Exception e) { e.printStackTrace(); } Gtk.main(); =09 } } test.glade:=20 <?xml version=3D"1.0" standalone=3D"no"?> <!--*- mode: xml -*--> <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> <widget class=3D"GtkWindow" id=3D"window1"> <property name=3D"visible">True</property> <property name=3D"title" translatable=3D"yes">window1</property> <property name=3D"type">GTK_WINDOW_TOPLEVEL</property> <property name=3D"window_position">GTK_WIN_POS_NONE</property> <property name=3D"modal">False</property> <property name=3D"resizable">True</property> <property name=3D"destroy_with_parent">False</property> <property name=3D"decorated">True</property> <property name=3D"skip_taskbar_hint">False</property> <property name=3D"skip_pager_hint">False</property> <property name=3D"type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name=3D"gravity">GDK_GRAVITY_NORTH_WEST</property> <property name=3D"focus_on_map">True</property> <child> <widget class=3D"GtkVBox" id=3D"vbox1"> <property name=3D"visible">True</property> <property name=3D"homogeneous">False</property> <property name=3D"spacing">0</property> <child> <widget class=3D"GtkButton" id=3D"button1"> <property name=3D"visible">True</property> <property name=3D"can_focus">True</property> <property name=3D"label" translatable=3D"yes">button</property> <property name=3D"use_underline">True</property> <property name=3D"relief">GTK_RELIEF_NORMAL</property> <property name=3D"focus_on_click">True</property> <signal name=3D"clicked" handler=3D"on_button1_clicked" last_modification_time=3D"Fri, 27 May 2005 20:51:54 GMT"/> </widget> <packing> <property name=3D"padding">0</property> <property name=3D"expand">False</property> <property name=3D"fill">False</property> </packing> </child> </widget> </child> </widget> </glade-interface> cheers gaboro |
From: Keith I. <ke...@ke...> - 2005-05-28 20:25:24
|
I think the method needs to be void: public void on_button1_clicked() { System.out.println("clicked"); } If you check out the tutorial on the java-gnome site, I think it explicitly says this somewhere. -K On Sat, 2005-05-28 at 22:16 +0200, Oláh Gábor wrote: > hiya, > > 2005-05-27, p keltezéssel 18.51-kor Jeff Morgan ezt írta: > > On 5/27/05, Oláh Gábor <ga...@cw...> wrote: > > > the error says: > > > java.lang.reflect.InvocationTargetException: ListenerDelegate.create > > > failure > > > > The problem here is that you have defined a callback > > (on_button_execute_clicked) but this method doesn't exist > > in your example. This is not a Java-GNOME bug. If you > > add this method you will see that it works fine. > thanks for the comment, but defining the method does no difference - i > get the same error... > > short example: > > package org.testing; > import java.io.FileNotFoundException; > import java.io.IOException; > import org.gnu.glade.GladeXMLException; > import org.gnu.glade.LibGlade; > import org.gnu.gtk.Gtk; > > public class HotplugManager { > > LibGlade glade; > > public HotplugManager() throws GladeXMLException, > FileNotFoundException, > IOException { > glade = new LibGlade("test.glade", this); > } > > public int on_button1_clicked() { > System.out.println("pressed"); > return 0; > } > > public static void main(String[] args) { > > HotplugManager hotplugman; > > Gtk.init(args); > try { > hotplugman = new HotplugManager(); > } catch(Exception e) { > e.printStackTrace(); > } > Gtk.main(); > > } > } > > test.glade: > > <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> > <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> > > <glade-interface> > > <widget class="GtkWindow" id="window1"> > <property name="visible">True</property> > <property name="title" translatable="yes">window1</property> > <property name="type">GTK_WINDOW_TOPLEVEL</property> > <property name="window_position">GTK_WIN_POS_NONE</property> > <property name="modal">False</property> > <property name="resizable">True</property> > <property name="destroy_with_parent">False</property> > <property name="decorated">True</property> > <property name="skip_taskbar_hint">False</property> > <property name="skip_pager_hint">False</property> > <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> > <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> > <property name="focus_on_map">True</property> > > <child> > <widget class="GtkVBox" id="vbox1"> > <property name="visible">True</property> > <property name="homogeneous">False</property> > <property name="spacing">0</property> > > <child> > <widget class="GtkButton" id="button1"> > <property name="visible">True</property> > <property name="can_focus">True</property> > <property name="label" translatable="yes">button</property> > <property name="use_underline">True</property> > <property name="relief">GTK_RELIEF_NORMAL</property> > <property name="focus_on_click">True</property> > <signal name="clicked" handler="on_button1_clicked" > last_modification_time="Fri, 27 May 2005 20:51:54 GMT"/> > </widget> > <packing> > <property name="padding">0</property> > <property name="expand">False</property> > <property name="fill">False</property> > </packing> > </child> > </widget> > </child> > </widget> > > </glade-interface> > > > cheers > gaboro > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Yahoo. > Introducing Yahoo! Search Developer Network - Create apps using Yahoo! > Search APIs Find out how you can build Yahoo! directly into your own > Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: <ga...@cw...> - 2005-05-28 20:35:37
|
2005-05-28, szo keltez=C3=A9ssel 13.25-kor Keith Irwin ezt =C3=ADrta: > I think the method needs to be void: >=20 > public void on_button1_clicked() { > System.out.println("clicked"); > } >=20 > If you check out the tutorial on the java-gnome site, I think it > explicitly says this somewhere. you are right, but it does not make any difference, either :-((. cheers gaboro |
From: Michael K. <mk...@gm...> - 2005-05-29 10:41:47
|
> > I think the method needs to be void: > > > > public void on_button1_clicked() { > > System.out.println("clicked"); > > } > > > > If you check out the tutorial on the java-gnome site, I think it > > explicitly says this somewhere. > you are right, but it does not make any difference, either :-((. > > cheers > gaboro Hello, I'm new to JG and this list, but perhaps I can help ... I have Ubuntu Hoary, too, and I encountered the same problem. I updated to JG 2.10 and everything runs fine. I'm not aware of Hoary packages for JG 2.10 so you have to compile it yourself. Cheers, Michael |
From: Tomasz M. <tmi...@co...> - 2005-05-29 08:50:39
|
Dnia 28-05-2005, sob o godzinie 22:35 +0200, Oláh Gábor napisał(a): > 2005-05-28, szo keltezéssel 13.25-kor Keith Irwin ezt írta: > > I think the method needs to be void: > > > > public void on_button1_clicked() { > > System.out.println("clicked"); > > } > > > > If you check out the tutorial on the java-gnome site, I think it > > explicitly says this somewhere. > you are right, but it does not make any difference, either :-((. I have the same problem still. maybe it's the problem of old java-gnome version? I use : libgladejava2.8.so libgtkjava2.4.so libgnomejava2.8.so regards. -- t.m. Tomasz Mielnik |
From: Remy S. <rem...@gm...> - 2005-05-29 09:29:49
|
> > I have the same problem still. > maybe it's the problem of old java-gnome version? > I use : > libgladejava2.8.so > libgtkjava2.4.so > libgnomejava2.8.so It might be a version issue. I'm running Java 1.4.2_08, libgtk-java 2.6.1, libgnome-java and libglade-java at 2.10.1 myself. I was able to run the code that Olah provided with no problems. Regards, Rem |