Thread: [Java-gnome-developer] Possibility to built SWING on top uf Java-GTK?
Brought to you by:
afcowie
From: Linuxhippy <lin...@we...> - 2003-01-08 21:47:47
|
Hi there again! My laptop is still broken, I write this mail with my old 15´ 60Hz Monotir ;-) Very often I hear about OpenSource-VMs like Kaffe, GCJ, ORP and many others. Many oft them are supporting AWT none of them have builtin-support for SWING. My IDEA (its only an idea!) is, to make not the same fault as SUN did with SWING (althought SWING is not bad, but its really slow and does absolutly not integrate in the native gui-interface). I thought that it should be possible to reinvent SWING an the top of a native gui-toolkit, but I want to ask you here, because of here are the real gui-gurus! (especally Jeff!!!) This implementation does not need to be exatly 100% compytible, I know this is not possible.... So please let me ask some questions relating to this theme: 1.) Would it be possible to use Java-GTK as the underlaying "platform". I know many things need to be reinvented in SWING style, but its better to code SWING in a "high-level-way" with java-gtk than dealing with native funktions. java-gtk does so many nice things for me (e.g. Memory handling), that I think it would be much easier to start with jgtk than from scratch... 2.) What about events and layouts? a) Would it be possible to widly emulate swing event, using and extending the current java-gtk event-model? b)How would it be possible to recode the swing-layouts using java-gtk. I know that swt has realized some java-like layouts using gtk... Would it be possible too rebuild all the layout-managers using a gtk-layout with fixed position? Would it be possible with boxes and tables? 3.)Is it important to rebuild exactly that heredity-hirachy (I´m sorry for my bad english, I know that word is wrong..) like sun does in swing? I know I not experienced with both Java/JNI/java-gtk enough to start a such project, but so many people are asking, and nobody does begin. This really bothers me so much, so that I want to start. I know I´m always a little bit rash, but so I´m ;-) I want to start this project, if its possible in most parts. I know its a very big amount of work, SWING is very big and SUN did not design SWING to be easy portable to native guis. But I´ve heard of a static-win32 Java-Compilier which translates SWING to native MFC-Programs, so its theoretical possible! Good luck again, Clemens PS: I was able to built Java-GTK on Windows using Cygwin. Hmm, but thats quite a very dirty port. It still requires an X-Server. The whole libraries (without the X-Server) are around ~20Mb (only GTK2, Pango, ZLIB.......). |
From: Helgi H. G. <he...@bi...> - 2003-01-08 22:39:31
|
Howdy. I must agree with the man. I've been wondering about this for quite some ti= me, now. Recently I was finally able to get myself a Mac, and I'm running Mac OS 10.= 2 on it. Amazed as I was, it runs Swing apps like native Mac OS 10.2 apps, = although the default (butt-ugly, pardon my French) Swing look can be used a= s well. I really do remember reading somewhere on java.sun.com that Swing was desig= ned to have widgets that belong to all popular widget sets, and since Sun a= re Unix-hackers I would only imagine they had taken Gtk+ into account (not = that Gtk+ is exactly lacking widgets). Mac OS X obviously has everything an= d I assume MFC does as well, according to what you just wrote. Regardless o= f all of this, I've never seen a widget or a tool in Java Swing apps that I= haven't seen in any of these toolkits. I also know that Gtk+ was designed specifically with language bindings in m= ind, so I really can't believe that it's impossible or even that difficult = to use native Gtk+ widgets instead of drawing the entire Swing thing from s= cratch (like the Sun VM does). This is just some rambling from me. :) I'm not good enough in Java (in fact= I barely know the language) to do this, but I would like to participate, o= nce I get this f***ing gnome-gcj thing up and running. Note: I have a strong personal policy of only using open-source software at= home, also I hate, HATE Swing as a seperate look and feel to everything el= se, so I probably won't learn Java until I get gnome-gcj up. Furthermore...= I want to run it as native machine-code, I really don't like the smell of = virtual machines altogether. :) The only real political question I can see is... do people really want Swin= g apps depending on JNI? I can only speak for myself, but I sure as s*** do= n't mind one bit. In fact I favour it more than than that childish (flames = to /dev/null) pure-Java concept. Just a comment, for you all to know, this idea must be common, and I only a= ssume interest is enough. Peace. Helgi Hrafn Gunnarsson he...@bi... On Wed, 08 Jan 2003 23:47:23 +0100 Linuxhippy <lin...@we...> wrote: > Hi there again! >=20 > My laptop is still broken, I write this mail with my old 15=B4 60Hz=20 > Monotir ;-) >=20 > Very often I hear about OpenSource-VMs like Kaffe, GCJ, ORP and many othe= rs. > Many oft them are supporting AWT none of them have builtin-support for=20 > SWING. >=20 > My IDEA (its only an idea!) is, to make not the same fault as SUN did=20 > with SWING (althought SWING is not bad, but its really slow and does=20 > absolutly not integrate in the native gui-interface). > I thought that it should be possible to reinvent SWING an the top of a=20 > native gui-toolkit, but I want to ask you here, because of here are the=20 > real gui-gurus! (especally Jeff!!!) > This implementation does not need to be exatly 100% compytible, I know=20 > this is not possible.... >=20 >=20 > So please let me ask some questions relating to this theme: >=20 > 1.) Would it be possible to use Java-GTK as the underlaying "platform". > I know many things need to be reinvented in SWING style, but its better=20 > to code SWING in a "high-level-way" with java-gtk than dealing with=20 > native funktions. > java-gtk does so many nice things for me (e.g. Memory handling), that I=20 > think it would be much easier to start with jgtk than from scratch... >=20 > 2.) What about events and layouts? > a) Would it be possible to widly emulate swing event, using and=20 > extending the current java-gtk event-model? > b)How would it be possible to recode the swing-layouts using java-gtk. I = > know that swt has realized some java-like layouts using gtk... > Would it be possible too rebuild all the layout-managers using a=20 > gtk-layout with fixed position? > Would it be possible with boxes and tables? >=20 > 3.)Is it important to rebuild exactly that heredity-hirachy (I=B4m sorry = > for my bad english, I know that word is wrong..) like sun does in swing? >=20 >=20 > I know I not experienced with both Java/JNI/java-gtk enough to start a=20 > such project, but so many people are asking, and nobody does begin. > This really bothers me so much, so that I want to start. I know I=B4m=20 > always a little bit rash, but so I=B4m ;-) > I want to start this project, if its possible in most parts. I know its=20 > a very big amount of work, SWING is very big and SUN did not design=20 > SWING to be easy portable to native guis. But I=B4ve heard of a=20 > static-win32 Java-Compilier which translates SWING to native=20 > MFC-Programs, so its theoretical possible! >=20 >=20 > Good luck again, Clemens >=20 > PS: I was able to built Java-GTK on Windows using Cygwin. > Hmm, but thats quite a very dirty port. It still requires an X-Server. > The whole libraries (without the X-Server) are around ~20Mb (only GTK2,=20 > Pango, ZLIB.......). >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See! > http://www.vasoftware.com > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Mark H. <mh...@ti...> - 2003-01-09 10:04:23
|
On Wed, 2003-01-08 at 22:47, Linuxhippy wrote: > Hi there again! Hi, There are many interesting ideas about GTK and Java and indeed many people have spent a lot of time working on them. However, none of them have been hugely successful. IMHO, the main reason for this is that none of them have been that good - people start work on projects but never complete them to a sufficient level that they become a feasible solution for developers. I think we need to spend a lot more time making java-gnome a lot better. There is still a huge amount to be done, especially if you are interested in running it on free jres. When this is done and there are a number of applications successfully powered by Java-Gnome, then is the time to be thinking of such extensions. -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |
From: Bill H. <bil...@su...> - 2003-01-09 13:32:14
|
On Wed, 2003-01-08 at 22:32, Helgi Hrafn Gunnarsson wrote: > Howdy. > > I must agree with the man. I've been wondering about this for quite some time, now. > > Recently I was finally able to get myself a Mac, and I'm running Mac OS 10.2 on it. > Amazed as I was, it runs Swing apps like native Mac OS 10.2 apps, although the > default (butt-ugly, pardon my French) Swing look can be used as well. Swing doesn't have to be slow; even some Sun VMs that do all the rendering in Java (rather than native widgets) are pretty fast. 1.4.X is lots lots faster than 1.3, and 1.3 was faster than 1.2's Swing (which, it has to be said, was kind of a dog from a performance point of view). All VMs have to do JNI somewhere. The issue is whether you maintain platform portability or not; if your JNI modules are either not available on all platforms with compliant Java VMs, or aren't always available on your "platform" (e.g. if they are GTK+ or Win32-specific), then you've lost the "write once run anywhere" concept of the VM. So I think it really does matter, this "pure Java" thing; not as a "purity of essence" thing but from the point of view of portability. If you don't care about portability, ok, but realize that many Java users do. It would be great to optimize Swing performance on every platform with a VM. There's no reason why this can't be done for GTK+, and as long as the result doesn't modify the Swing APIs incompatibly or introduce new APIs into the javax.swing or com.sun namespaces, this is even compatible with the 'JCP' as I understand it (again, flames to /dev/null, I am a GPL/LGPL advocate too). But any nonstandard API should be in a different namespace. > I really do remember reading somewhere on java.sun.com that Swing was designed to have > widgets that belong to all popular widget sets, and since Sun are Unix-hackers I > would only imagine they had taken Gtk+ into account (not that Gtk+ is exactly lacking > widgets). Mac OS X obviously has everything and I assume MFC does as well, according > to what you just wrote. Regardless of all of this, I've never seen a widget or a tool > in Java Swing apps that I haven't seen in any of these toolkits. > > I also know that Gtk+ was designed specifically with language bindings in mind, so I > really can't believe that it's impossible or even that difficult to use native Gtk+ > widgets instead of drawing the entire Swing thing from scratch (like the Sun VM does). > > This is just some rambling from me. :) I'm not good enough in Java (in fact I barely > know the language) to do this, but I would like to participate, once I get this > f***ing gnome-gcj thing up and running. > > Note: I have a strong personal policy of only using open-source software at home, Java's certainly "open source". Whether or not it's "free" depends on your definitions, and how you feel about the JCP licensing restrictions on what kind of modifications to the VM you are free to redistribute. But Java can and is being used to write Free Software, under BSD-style, Apache, and LGPL licenses (and I have done lots of this). > also I hate, HATE Swing as a seperate look and feel to everything else, so I probably > won't learn Java until I get gnome-gcj up. Note that Sun's 1.5 VM will have a GTK+ look and feel for Swing, which should make you happier... > Furthermore... I want to run it as native machine-code, I really don't like the > smell of virtual machines altogether. :) > > The only real political question I can see is... do people really want Swing > apps depending on JNI? I can only speak for myself, but I sure as s*** don't > mind one bit. In fact I favour it more than than that childish > (flames to /dev/null) pure-Java concept. This may not be feasible without going through the (ugh) JCP. As I said, it might be embraced with the right planning, but I am dubious that you can redistribute code that changes javax.swing.* modules without permission. Anyhow, you might want to try Swing with a recent VM if you are taking 1.3 as your performance benchmark. Maybe 1.5's improvements will also help narrow the performance and integration/interop gaps so that using Swing in non-native mode is more palatable to GNOME developers, too. I think there are other areas where integration and interoperability work between GNOME and Java might be even more useful in the future. And *please* don't flame me, I am not on the Sun Java team, I didn't write the licenses, I am *not* a lawyer, etc, etc. :-) I use and write Java, GNOME, GTK+, etc. Best regards, Bill > > Bill Haneman <bil...@su...> |
From: Helgi H. G. <he...@bi...> - 2003-01-09 14:12:18
|
Well, the slowness of Swing is not at all what I would argue about. The only thing I find silly about Swing is that it doesn't (for now, at least) use native widgets to display windows and their content. If in Swing 1.5 they'll actually bind it to the native Gtk+ lying on whichever platform you're running, that'll be great. But simply imitating the default Gtk+ look & feel wouldn't be a solution to the problem. For example, if I change the theme of Gtk+, I would want Swing apps to use the same thing, regardless of what Java feels about it, since that functionality should be in the native widget set itself, in our case, Gtk+. Whether this'll be the case for 1.5 or not, I don't know, I couldn't tell by your words. If this is what they'll do, I'll embrace Java Swing much sooner. Furthermore, if that's the case, a specific Linux project of implementing Gtk+ in Swing (with the relevant and cross-platform Swing API and all that stuff) would be rather pointless. We wouldn't get the project in a runnable state before 1.5 anyway. If you can, please elaborate on what you meant by your words on 1.5. Do you know if they're planning on using the native, underlying Gtk+ set or are they just going to imitate it? The underlying code running Swing can be slow as hell for all I care. The greatest slowdown in Swing so far has been drawing the UI itself through whichever technology they've used so far. But like I said, the slowness isn't the point, that can be remedied later. Using the Gtk+ widget set from the underlying OS, however, would be politically a more correct way, since that would dump the performance responsibility to the underlying OS and libraries, where that responsibility belongs rightfully. Peace. Helgi Hrafn Gunnarsson On 09 Jan 2003 13:22:10 +0000 Bill Haneman <bil...@su...> wrote: > On Wed, 2003-01-08 at 22:32, Helgi Hrafn Gunnarsson wrote: > > Howdy. > > > > I must agree with the man. I've been wondering about this for quite some time, now. > > > > Recently I was finally able to get myself a Mac, and I'm running Mac OS 10.2 on it. > > Amazed as I was, it runs Swing apps like native Mac OS 10.2 apps, although the > > default (butt-ugly, pardon my French) Swing look can be used as well. > > Swing doesn't have to be slow; even some Sun VMs that do all the > rendering in Java (rather than native widgets) are pretty fast. 1.4.X > is lots lots faster than 1.3, and 1.3 was faster than 1.2's Swing > (which, it has to be said, was kind of a dog from a performance point of > view). > > All VMs have to do JNI somewhere. The issue is whether you maintain > platform portability or not; if your JNI modules are either not > available on all platforms with compliant Java VMs, or aren't always > available on your "platform" (e.g. if they are GTK+ or Win32-specific), > then you've lost the "write once run anywhere" concept of the VM. > > So I think it really does matter, this "pure Java" thing; not as a > "purity of essence" thing but from the point of view of portability. If > you don't care about portability, ok, but realize that many Java users > do. > > It would be great to optimize Swing performance on every platform with a > VM. There's no reason why this can't be done for GTK+, and as long as > the result doesn't modify the Swing APIs incompatibly or introduce new > APIs into the javax.swing or com.sun namespaces, this is even compatible > with the 'JCP' as I understand it (again, flames to /dev/null, I am a > GPL/LGPL advocate too). But any nonstandard API should be in a > different namespace. > > > I really do remember reading somewhere on java.sun.com that Swing was designed to have > > widgets that belong to all popular widget sets, and since Sun are Unix-hackers I > > would only imagine they had taken Gtk+ into account (not that Gtk+ is exactly lacking > > widgets). Mac OS X obviously has everything and I assume MFC does as well, according > > to what you just wrote. Regardless of all of this, I've never seen a widget or a tool > > in Java Swing apps that I haven't seen in any of these toolkits. > > > > I also know that Gtk+ was designed specifically with language bindings in mind, so I > > really can't believe that it's impossible or even that difficult to use native Gtk+ > > widgets instead of drawing the entire Swing thing from scratch (like the Sun VM does). > > > > This is just some rambling from me. :) I'm not good enough in Java (in fact I barely > > know the language) to do this, but I would like to participate, once I get this > > f***ing gnome-gcj thing up and running. > > > > Note: I have a strong personal policy of only using open-source software at home, > > Java's certainly "open source". Whether or not it's "free" depends on > your definitions, and how you feel about the JCP licensing restrictions > on what kind of modifications to the VM you are free to redistribute. > But Java can and is being used to write Free Software, under BSD-style, > Apache, and LGPL licenses (and I have done lots of this). > > > also I hate, HATE Swing as a seperate look and feel to everything else, so I probably > > won't learn Java until I get gnome-gcj up. > > Note that Sun's 1.5 VM will have a GTK+ look and feel for Swing, which > should make you happier... > > > Furthermore... I want to run it as native machine-code, I really don't like the > > smell of virtual machines altogether. :) > > > > The only real political question I can see is... do people really want Swing > > apps depending on JNI? I can only speak for myself, but I sure as s*** don't > > mind one bit. In fact I favour it more than than that childish > > (flames to /dev/null) pure-Java concept. > > This may not be feasible without going through the (ugh) JCP. As I said, > it might be embraced with the right planning, but I am dubious that you > can redistribute code that changes javax.swing.* modules without > permission. > > Anyhow, you might want to try Swing with a recent VM if you are taking > 1.3 as your performance benchmark. Maybe 1.5's improvements will also > help narrow the performance and integration/interop gaps so that using > Swing in non-native mode is more palatable to GNOME developers, too. I > think there are other areas where integration and interoperability work > between GNOME and Java might be even more useful in the future. > > And *please* don't flame me, I am not on the Sun Java team, I didn't > write the licenses, I am *not* a lawyer, etc, etc. :-) I use and write > Java, GNOME, GTK+, etc. > > Best regards, > > Bill > > > > > Bill Haneman <bil...@su...> > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Bill H. <bil...@su...> - 2003-01-09 14:29:57
|
Hi again Helgi: On Thu, 2003-01-09 at 14:08, Helgi Hrafn Gunnarsson wrote: > For example, if I change the theme of Gtk+, I would want Swing > apps to use the same thing, regardless of what Java feels about it, > since that functionality should be in the native widget set itself, > in our case, Gtk+. Whether this'll be the case for 1.5 or not, > I don't know, I couldn't tell by your words. If this is what they'll do, > I'll embrace Java Swing much sooner. Furthermore, if that's the case, > a specific Linux project of implementing Gtk+ in Swing (with the > relevant and cross-platform Swing API and all that stuff) would be > rather pointless. We wouldn't get the project in a runnable state > before 1.5 anyway. What 1.5. will do is _emulate_ the gtk+ default engine, including the engine's themability. So in 1.5 Swing will match the current gtk+ theme and system font size, etc. provided the theme uses either the default engine or something similar. For instance the themes currently in gnome-themes (which will be part of the GNOME 2.2 release) should all work well with 1.5's Swing (and reports are that they do). But if you install a totally different gtk+ engine, your results may vary. As long as the gtk+ theme in question continues to use the standard gtk+ RC file format, results should be pretty good, except for possibly things like bevels versus radius if widget borders, etc. So the 1.5 solution is not all-inclusive but it will work for a wide variety of GNOME/GTK+ themes including the 'standard' GNOME-2.2 ones. > > If you can, please elaborate on what you meant by your words on 1.5. > Do you know if they're planning on using the native, underlying Gtk+ > set or are they just going to imitate it? > > The underlying code running Swing can be slow as hell for all I care. > The greatest slowdown in Swing so far has been drawing the UI itself > through whichever technology they've used so far. But like I said, > the slowness isn't the point, that can be remedied later. Using the > Gtk+ widget set from the underlying OS, however, would be politically > a more correct way, since that would dump the performance > responsibility to the underlying OS and libraries, where that > responsibility belongs rightfully. There are 'political' and practical concerns either way; if you introduce a dependency on gtk+, you are (potentially) breaking the platform-independence of Swing. Of course if the change is only a pluggable 'optimization' (as it seems to be in MacOS) then it's win-win. Certainly if a non-default gtk+ engine becomes popular, Swing's PLAF mechanism allows you to write a new Swing look to match it. Perhaps that would be a better project than re-writing Swing to use native widgets, in terms of portability and also feasibility. I don't recall offhand if a PLAF could be used to substitute a whole native widget set... perhaps it is technically possible but I doubt anyone has tried it. That would be worth exploring however, since it's an officially sanctioned mechanism for changing Swing's UI implementation, and would work with any compliant VM. best regards, Bill > > Peace. > Helgi Hrafn Gunnarsson > -- Bill Haneman <bil...@su...> |