Thread: [Java-gnome-developer] Some questions from the tutorial.
Brought to you by:
afcowie
From: Rishabh M. <rma...@gm...> - 2004-09-17 05:54:48
Attachments:
Third.java
|
Hey guys, I am a new user of java-gnome and let me just start off by saying thank you to all the developers who have provided this great library. I am new to dsigning GUI's so excuse my naiveity. I was going through the tutorial given on the main java-gnome site. Everything seems to work fine. Only that when I click the Quit button or the Help/About button, I get nothing. As far as i can see through the code, I think both of these click should lead to their respective events? I am attaching my java file along with this e-mail for you guys to look over. Oh and my specs: debian sid kernel 2.6.4 with the Sun 1.4.2 sdk compiler and VM. Thanks Rishabh |
From: Rishabh M. <rma...@gm...> - 2004-09-18 20:51:41
Attachments:
Second.java
|
Could someone please help me with this. I have understood the rest of the tutorial but an not able to do much since i do not yet understand howto execute click events from the menu. I am attaching a smaller file for review. thanks Rishabh On Fri, 17 Sep 2004 00:54:46 -0500, Rishabh Manocha <rma...@gm...> wrote: > Hey guys, > I am a new user of java-gnome and let me just start off by saying > thank you to all the developers who have provided this great library. > I am new to dsigning GUI's so excuse my naiveity. > I was going through the tutorial given on the main java-gnome site. > Everything seems to work fine. Only that when I click the Quit button > or the Help/About button, I get nothing. As far as i can see through > the code, I think both of these click should lead to their respective > events? > I am attaching my java file along with this e-mail for you guys to look over. > Oh and my specs: debian sid kernel 2.6.4 with the Sun 1.4.2 sdk compiler and VM. > Thanks > Rishabh > > > > |
From: Mark H. <mh...@ti...> - 2004-09-19 10:05:22
|
I've only looked at this quickly, but it seems that you've defined a listener for menu item events but not told the menuitems to use that listener. To make them use a listener, you must call MyMenuItem.addListener( MyMenuItemListener ) for each of them. One probably more important recommendation I have is to try using glade instead -- This makes it far easier to construct java-gnome guis. Unfortunately, development of the glade tutorial is stalled at the moment, but you should be able to pick it up easily enough. Ask here if you need more help -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... |
From: Rishabh M. <rma...@gm...> - 2004-09-19 22:02:52
|
Hi, Thanks for your reply. On Sun, 19 Sep 2004 11:05:07 +0100, Mark Howard <mh...@ti...> wrote: > I've only looked at this quickly, but it seems that you've defined a listener > for menu item events but not told the menuitems to use that listener. To make > them use a listener, you must call MyMenuItem.addListener( MyMenuItemListener ) > for each of them. For which object do I call the addListener method. I am using an array of UIInfo objects for the menu items and then just add them to the APP object running the whole show. I dont see where i need to add the addListener method. Could you help me out with this? > One probably more important recommendation I have is to try using glade instead > -- This makes it far easier to construct java-gnome guis. Unfortunately, > development of the glade tutorial is stalled at the moment, but you should be > able to pick it up easily enough. Ask here if you need more help I figured i would first do some of the work by hand so that i get an idea of the whole procedure and then move onto glade. Thanks Rishabh Manocha > -- > .''`. Mark Howard > : :' : > `. `' http://www.tildemh.com > `- mh...@de... | mh...@ti... > |
From: Rishabh M. <rma...@gm...> - 2004-09-19 22:29:30
|
hey guys, I changed the createMEnu section to so(I noticed that App has a method called setMenuBar which accepts a MenuBar object): public void createMenu() { MenuBar bar = new MenuBar(); MenuItem child = new MenuItem("File",false); Menu file = new Menu(); MenuItem quit = new MenuItem("Quit",false); quit.addListener(new ItemListener() { public void itemEvent(ItemEvent event) { fileExit(); } }); file.append(quit); child.setSubmenu(file); bar.append(child); this.app.setMenuBar(bar); } However this does not show a menubar at all. I feel I am so close but yet so far. Could someone pleaaaaase help me. Thanks --Rishabh On Sun, 19 Sep 2004 17:02:46 -0500, Rishabh Manocha <rma...@gm...> wrote: > Hi, > Thanks for your reply. > > > On Sun, 19 Sep 2004 11:05:07 +0100, Mark Howard <mh...@ti...> wrote: > > I've only looked at this quickly, but it seems that you've defined a listener > > for menu item events but not told the menuitems to use that listener. To make > > them use a listener, you must call MyMenuItem.addListener( MyMenuItemListener ) > > for each of them. > For which object do I call the addListener method. I am using an array > of UIInfo objects for the menu items and then just add them to the APP > object running the whole show. I dont see where i need to add the > addListener method. Could you help me out with this? > > One probably more important recommendation I have is to try using glade instead > > -- This makes it far easier to construct java-gnome guis. Unfortunately, > > development of the glade tutorial is stalled at the moment, but you should be > > able to pick it up easily enough. Ask here if you need more help > I figured i would first do some of the work by hand so that i get an > idea of the whole procedure and then move onto glade. > Thanks > Rishabh Manocha > > > > -- > > .''`. Mark Howard > > : :' : > > `. `' http://www.tildemh.com > > `- mh...@de... | mh...@ti... > > > |
From: Andrew C. <an...@op...> - 2004-09-19 23:56:28
|
On Sun, 2004-09-19 at 17:02 -0500, Rishabh Manocha wrote: > I figured i would first do some of the work by hand so that i get an > idea of the whole procedure and then move onto glade. Yeah, I tried that and ended up being tricked by the same inadequacies of UIInfo that you were. It's just not a very good way to do things.=20 What I've settled on is using libglade for basic window layout, because it's really good at taking care of all the mundane property setting l (like packing on VBoxs, window sizes, gravity, etc) - and then I use straight up GTK calls to add elements to the UI as I need them. In particular, I've been testing libgtkhtml. There is *no* Glade support for GtkHtml widgets (that's not a Java issue - it's a Glade one). Rather than giving up on glade, I simply get the container that's where I want to put the widget from libglade (in this case "vbox1"): LibGlade glade =3D null; HTMLView gtkhtml =3D null; try { glade =3D new LibGlade("htmltest.glade", this); } catch (Exception e) { e.printStackTrace(); } =09 VBox vbox =3D (VBox) glade.getWidget("vbox1"); instantiate the GtkHTML widget, HTMLDocument doc =3D new HTMLDocument(); try { doc.loadFile("htmltest.html"); } catch (Exception e) { e.printStackTrace(); } gtkhtml =3D new HTMLView(); gtkhtml.setDocument(doc); gtkhtml.setMinimumSize(10,40); and then pack the widget on the end of the vbox. vbox.packEnd(gtkhtml, true, true, 0); vbox.showAll(); Works pretty well. AfC Sydney --=20 Andrew Frederick Cowie OPERATIONAL DYNAMICS Operations Consultants and Infrastructure Engineers http://www.operationaldynamics.com/ |
From: Rishabh M. <rma...@gm...> - 2004-09-20 05:16:33
|
umm...I dont seem to be able to compile files with glade objects. I cant seem to find the libglade.jar file?? I am using debian and i issued the command given on the java-gnome website to install all the packages. here is all what i have: ii libglade0-java 2.6.0.1-7 Dummy package to aid upgrade ii libglade2-java 2.6.0.1-7 Java support for libglade gnome interface ii libgnome0-java 2.6.0.1-7 Dummy package to aid upgrade ii libgnome2-java 2.6.0.1-7 Java framework for creating GNOME applicatio ii libgnome2-jni 2.6.0.1-7 Java framework for creating GNOME applicatio ii libgtk0-java 2.6.0.1-7 Dummy package to aid upgrade ii libgtk2-java 2.6.0.1-7 Gtk framework for Java ii libgtk2-jni 2.6.0.1-7 GTK framework for Java ii libjava-gnome- 2.6.0.1-7 API docs and example apps for GTK/GNOME java I know i might be irritating some people out here...but can someone help me with this. I did get the libglade package from the sf site but the src directory does not seem to compile and hence i cant create the jar file myself. I will try to do this again though. In the meanwhile...any and all suggestions are welcome...:) --Rishabh On Mon, 20 Sep 2004 09:56:22 +1000, Andrew Cowie <an...@op...> wrote: > On Sun, 2004-09-19 at 17:02 -0500, Rishabh Manocha wrote: > > I figured i would first do some of the work by hand so that i get an > > idea of the whole procedure and then move onto glade. > > Yeah, I tried that and ended up being tricked by the same inadequacies > of UIInfo that you were. It's just not a very good way to do things. > > What I've settled on is using libglade for basic window layout, because > it's really good at taking care of all the mundane property setting l > (like packing on VBoxs, window sizes, gravity, etc) - and then I use > straight up GTK calls to add elements to the UI as I need them. > > In particular, I've been testing libgtkhtml. There is *no* Glade support > for GtkHtml widgets (that's not a Java issue - it's a Glade one). Rather > than giving up on glade, I simply get the container that's where I want > to put the widget from libglade (in this case "vbox1"): > > LibGlade glade = null; > HTMLView gtkhtml = null; > > try { > glade = new LibGlade("htmltest.glade", this); > } catch (Exception e) { > e.printStackTrace(); > } > > VBox vbox = (VBox) glade.getWidget("vbox1"); > > instantiate the GtkHTML widget, > > HTMLDocument doc = new HTMLDocument(); > try { > doc.loadFile("htmltest.html"); > } catch (Exception e) { > e.printStackTrace(); > } > > gtkhtml = new HTMLView(); > gtkhtml.setDocument(doc); > gtkhtml.setMinimumSize(10,40); > > and then pack the widget on the end of the vbox. > > vbox.packEnd(gtkhtml, true, true, 0); > vbox.showAll(); > > Works pretty well. > > AfC > Sydney > > -- > Andrew Frederick Cowie > > OPERATIONAL DYNAMICS > Operations Consultants and Infrastructure Engineers > > http://www.operationaldynamics.com/ > > > > |
From: Rishabh M. <rma...@gm...> - 2004-09-20 05:17:05
|
oh and i forgot to all...I do have the libglade libraries(the .so files) in /usr/lib/jni/ thanks --Rishabh On Mon, 20 Sep 2004 00:16:26 -0500, Rishabh Manocha <rma...@gm...> wrote: > umm...I dont seem to be able to compile files with glade objects. I > cant seem to find the libglade.jar file?? > I am using debian and i issued the command given on the java-gnome > website to install all the packages. > here is all what i have: > > ii libglade0-java 2.6.0.1-7 Dummy package to aid upgrade > ii libglade2-java 2.6.0.1-7 Java support for libglade gnome interface > ii libgnome0-java 2.6.0.1-7 Dummy package to aid upgrade > ii libgnome2-java 2.6.0.1-7 Java framework for creating GNOME applicatio > ii libgnome2-jni 2.6.0.1-7 Java framework for creating GNOME applicatio > ii libgtk0-java 2.6.0.1-7 Dummy package to aid upgrade > ii libgtk2-java 2.6.0.1-7 Gtk framework for Java > ii libgtk2-jni 2.6.0.1-7 GTK framework for Java > ii libjava-gnome- 2.6.0.1-7 API docs and example apps for GTK/GNOME java > > I know i might be irritating some people out here...but can someone > help me with this. I did get the libglade package from the sf site but > the src directory does not seem to compile and hence i cant create the > jar file myself. I will try to do this again though. > In the meanwhile...any and all suggestions are welcome...:) > --Rishabh > > > On Mon, 20 Sep 2004 09:56:22 +1000, Andrew Cowie > <an...@op...> wrote: > > On Sun, 2004-09-19 at 17:02 -0500, Rishabh Manocha wrote: > > > I figured i would first do some of the work by hand so that i get an > > > idea of the whole procedure and then move onto glade. > > > > Yeah, I tried that and ended up being tricked by the same inadequacies > > of UIInfo that you were. It's just not a very good way to do things. > > > > What I've settled on is using libglade for basic window layout, because > > it's really good at taking care of all the mundane property setting l > > (like packing on VBoxs, window sizes, gravity, etc) - and then I use > > straight up GTK calls to add elements to the UI as I need them. > > > > In particular, I've been testing libgtkhtml. There is *no* Glade support > > for GtkHtml widgets (that's not a Java issue - it's a Glade one). Rather > > than giving up on glade, I simply get the container that's where I want > > to put the widget from libglade (in this case "vbox1"): > > > > LibGlade glade = null; > > HTMLView gtkhtml = null; > > > > try { > > glade = new LibGlade("htmltest.glade", this); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > > > VBox vbox = (VBox) glade.getWidget("vbox1"); > > > > instantiate the GtkHTML widget, > > > > HTMLDocument doc = new HTMLDocument(); > > try { > > doc.loadFile("htmltest.html"); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > > > gtkhtml = new HTMLView(); > > gtkhtml.setDocument(doc); > > gtkhtml.setMinimumSize(10,40); > > > > and then pack the widget on the end of the vbox. > > > > vbox.packEnd(gtkhtml, true, true, 0); > > vbox.showAll(); > > > > Works pretty well. > > > > AfC > > Sydney > > > > -- > > Andrew Frederick Cowie > > > > OPERATIONAL DYNAMICS > > Operations Consultants and Infrastructure Engineers > > > > http://www.operationaldynamics.com/ > > > > > > > > > |
From: Mark H. <mh...@ti...> - 2004-10-10 13:48:11
|
Hi, Sorry for taking so long to reply. Do you have a call to showAll() in your code? On Sun, Sep 19, 2004 at 05:29:21PM -0500, Rishabh Manocha wrote: > > public void createMenu() { > MenuBar bar = new MenuBar(); > MenuItem child = new MenuItem("File",false); > Menu file = new Menu(); > MenuItem quit = new MenuItem("Quit",false); > quit.addListener(new ItemListener() { > public void itemEvent(ItemEvent event) { > fileExit(); > } > }); > file.append(quit); > child.setSubmenu(file); > bar.append(child); > this.app.setMenuBar(bar); > } > > However this does not show a menubar at all. I feel I am so close but > yet so far. -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... |
From: Rishabh M. <rma...@gm...> - 2004-10-10 18:10:48
|
Thanks for writing back, but i have managed to slove this problem. My problem now is the About window not accepting any click events. I will reply to the e-mail you sent. Thanks --Rishabh On Sun, 10 Oct 2004 14:47:24 +0100, Mark Howard <mh...@ti...> wrote: > Hi, > > Sorry for taking so long to reply. Do you have a call to showAll() in your code? > > > > On Sun, Sep 19, 2004 at 05:29:21PM -0500, Rishabh Manocha wrote: > > > > public void createMenu() { > > MenuBar bar = new MenuBar(); > > MenuItem child = new MenuItem("File",false); > > Menu file = new Menu(); > > MenuItem quit = new MenuItem("Quit",false); > > quit.addListener(new ItemListener() { > > public void itemEvent(ItemEvent event) { > > fileExit(); > > } > > }); > > file.append(quit); > > child.setSubmenu(file); > > bar.append(child); > > this.app.setMenuBar(bar); > > } > > > > However this does not show a menubar at all. I feel I am so close but > > yet so far. > > -- > .''`. Mark Howard > : :' : > `. `' http://www.tildemh.com > `- mh...@de... | mh...@ti... > |
From: Skip C. <sco...@gm...> - 2004-10-14 00:42:57
|
Rishabh, I have also been going through the tutorial and have come against the same problem you have with the event listener . How did you resolve it ? scoon On Sun, 10 Oct 2004 13:10:36 -0500, Rishabh Manocha <rma...@gm...> wrote: > Thanks for writing back, but i have managed to slove this problem. My > problem now is the About window not accepting any click events. > I will reply to the e-mail you sent. > Thanks > --Rishabh > > > > > On Sun, 10 Oct 2004 14:47:24 +0100, Mark Howard <mh...@ti...> wrote: > > Hi, > > > > Sorry for taking so long to reply. Do you have a call to showAll() in your code? > > > > > > > > On Sun, Sep 19, 2004 at 05:29:21PM -0500, Rishabh Manocha wrote: > > > > > > public void createMenu() { > > > MenuBar bar = new MenuBar(); > > > MenuItem child = new MenuItem("File",false); > > > Menu file = new Menu(); > > > MenuItem quit = new MenuItem("Quit",false); > > > quit.addListener(new ItemListener() { > > > public void itemEvent(ItemEvent event) { > > > fileExit(); > > > } > > > }); > > > file.append(quit); > > > child.setSubmenu(file); > > > bar.append(child); > > > this.app.setMenuBar(bar); > > > } > > > > > > However this does not show a menubar at all. I feel I am so close but > > > yet so far. > > > > -- > > .''`. Mark Howard > > : :' : > > `. `' http://www.tildemh.com > > `- mh...@de... | mh...@ti... > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > |
From: Rishabh M. <rma...@gm...> - 2004-10-14 19:17:33
|
I didnt find a solution persay. All i did was started using glade to do all the GUI designing work. That took care of everything. I would suggest doing the same. It really cleans up your code. --Rishabh On Wed, 13 Oct 2004 20:42:51 -0400, Skip Coon <sco...@gm...> wrote: > Rishabh, > > I have also been going through the tutorial and have come against the > same problem you have with the event listener . How did you resolve > it ? > > scoon > > > > > On Sun, 10 Oct 2004 13:10:36 -0500, Rishabh Manocha <rma...@gm...> wrote: > > Thanks for writing back, but i have managed to slove this problem. My > > problem now is the About window not accepting any click events. > > I will reply to the e-mail you sent. > > Thanks > > --Rishabh > > > > > > > > > > On Sun, 10 Oct 2004 14:47:24 +0100, Mark Howard <mh...@ti...> wrote: > > > Hi, > > > > > > Sorry for taking so long to reply. Do you have a call to showAll() in your code? > > > > > > > > > > > > On Sun, Sep 19, 2004 at 05:29:21PM -0500, Rishabh Manocha wrote: > > > > > > > > public void createMenu() { > > > > MenuBar bar = new MenuBar(); > > > > MenuItem child = new MenuItem("File",false); > > > > Menu file = new Menu(); > > > > MenuItem quit = new MenuItem("Quit",false); > > > > quit.addListener(new ItemListener() { > > > > public void itemEvent(ItemEvent event) { > > > > fileExit(); > > > > } > > > > }); > > > > file.append(quit); > > > > child.setSubmenu(file); > > > > bar.append(child); > > > > this.app.setMenuBar(bar); > > > > } > > > > > > > > However this does not show a menubar at all. I feel I am so close but > > > > yet so far. > > > > > > -- > > > .''`. Mark Howard > > > : :' : > > > `. `' http://www.tildemh.com > > > `- mh...@de... | mh...@ti... > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > > Use IT products in your business? Tell us what you think of them. Give us > > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > > http://productguide.itmanagersjournal.com/guidepromo.tmpl > > _______________________________________________ > > java-gnome-developer mailing list > > jav...@li... > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > |
From: Skip C. <sco...@gm...> - 2004-10-15 01:24:22
|
Rishabh, I will do. Thanks. scoon On Thu, 14 Oct 2004 14:17:22 -0500, Rishabh Manocha <rma...@gm...> wrote: > I didnt find a solution persay. All i did was started using glade to > do all the GUI designing work. That took care of everything. I would > suggest doing the same. It really cleans up your code. > --Rishabh > > > > > On Wed, 13 Oct 2004 20:42:51 -0400, Skip Coon <sco...@gm...> wrote: > > Rishabh, > > > > I have also been going through the tutorial and have come against the > > same problem you have with the event listener . How did you resolve > > it ? > > > > scoon > > > > > > > > > > On Sun, 10 Oct 2004 13:10:36 -0500, Rishabh Manocha <rma...@gm...> wrote: > > > Thanks for writing back, but i have managed to slove this problem. My > > > problem now is the About window not accepting any click events. > > > I will reply to the e-mail you sent. > > > Thanks > > > --Rishabh > > > > > > > > > > > > > > > On Sun, 10 Oct 2004 14:47:24 +0100, Mark Howard <mh...@ti...> wrote: > > > > Hi, > > > > > > > > Sorry for taking so long to reply. Do you have a call to showAll() in your code? > > > > > > > > > > > > > > > > On Sun, Sep 19, 2004 at 05:29:21PM -0500, Rishabh Manocha wrote: > > > > > > > > > > public void createMenu() { > > > > > MenuBar bar = new MenuBar(); > > > > > MenuItem child = new MenuItem("File",false); > > > > > Menu file = new Menu(); > > > > > MenuItem quit = new MenuItem("Quit",false); > > > > > quit.addListener(new ItemListener() { > > > > > public void itemEvent(ItemEvent event) { > > > > > fileExit(); > > > > > } > > > > > }); > > > > > file.append(quit); > > > > > child.setSubmenu(file); > > > > > bar.append(child); > > > > > this.app.setMenuBar(bar); > > > > > } > > > > > > > > > > However this does not show a menubar at all. I feel I am so close but > > > > > yet so far. > > > > > > > > -- > > > > .''`. Mark Howard > > > > : :' : > > > > `. `' http://www.tildemh.com > > > > `- mh...@de... | mh...@ti... > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > > > Use IT products in your business? Tell us what you think of them. Give us > > > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > > > http://productguide.itmanagersjournal.com/guidepromo.tmpl > > > _______________________________________________ > > > java-gnome-developer mailing list > > > jav...@li... > > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > > > > |