Re: [Java-gnome-developer] Possibility to built SWING on top uf Java-GTK?
Brought to you by:
afcowie
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...> |