Re: [gtk-list] Java + GTK project



>>>>> "Nathan" == Nathan Oliver John Whitehead <whitehno@whitman.edu> writes:

Nathan> I have decided to use JNI for interfacing to GTK, so my
Nathan> library requires JDK-1.2.  Has anyone else already done all
Nathan> this, and if so, where can I find it?  If not, is anyone else
Nathan> currently working on a project similar to this so we could
Nathan> collaborate?

Someone started doing this, but I don't know that they finished.  I no
longer have the URL, but a net search ought to turn it up.

BTW have you considered using gcj and CNI instead of JNI?  CNI is much
faster.  Perhaps changing your stub generator to work either way would
be useful.  See http://sourceware.cygnus.com/java for info on gcj.

Nathan> The basic idea is that JGTK uses handles (integers) to
Nathan> represent pointers to widgets.

Why not use wrapper objects?  Then method calls can really be methods
-- a more convenient model.

Nathan> Signal handling is different because Java does not allow
Nathan> pointers to functions.  Instead a reference to an object is
Nathan> passed to signal_connect, and then when an event occurs, the
Nathan> method eventHandler of that object is called.

I think it is more natural to use interfaces.  Use a unique interface
per signal, with a single function in the interface whose signature
matches that of the signal.  Then a given Java object can be connected
to as many signals as you like.

Nathan> Right now I am working on entering functions into my parse
Nathan> file to support more widgets and more functions for each
Nathan> widget.

Are you aware of the "gtk.defs" file?  This already has all the
functions in it.  I don't think it contains information about signal
signatures (though it seems like it should -- does anybody know why it
doesn't?).

Tom



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]