X11 based GUI toolkit for java on unix AND windows

A

Andrew

Does anyone know of an X11 GUI toolkit for java that is available on
both unix and windows? gnome-java is unix-only but is otherwise just
the sort of thing I am looking for.

Regards,

Andrew Marlow
 
N

Nigel Wade

Does anyone know of an X11 GUI toolkit for java that is available on
both unix and windows? gnome-java is unix-only but is otherwise just the
sort of thing I am looking for.

Regards,

Andrew Marlow

Is there something wrong with Swing? If you want a cross-platform
solution why not use the cross-platform GUI that comes as part of the
standard API?

I'd assume that gnome-java provides you with Gnome desktop integration,
which by its very nature will not be cross-platform just as Windows
native GUI toolkits will not be.
 
A

abc

Andrew said:
Does anyone know of an X11 GUI toolkit for java that is available on
both unix and windows? gnome-java is unix-only but is otherwise just
the sort of thing I am looking for.

Have you tried getting gnome-java to work under Windows in cygwin?
 
A

Andrew

I'd assume that gnome-java provides you with Gnome desktop integration,
which by its very nature will not be cross-platform just as Windows
native GUI toolkits will not be.

java-gnome looks great but only for POSIX environments since it is
built on GTK. I like GTK but GTK is not really fully available for
Windoze. And my solution needs to be available on both. I have tried
building GTK from scratch and it is really difficult - the web of
package dependencies is very hairy!

-Andrew Marlow
 
A

Andrew

Isn't wireshark dependent on Gtk?http://www.wireshark.org/docs/wsdg_html_chunked/ChUIGTK.html
I use Wireshark on Windows.

Wireshark is an example of a multi-OS app that is built on GTK. There
are other examples. I have used pan, a USENET reader, on Windoze. It
too is built on GTK. The pan MSI comes with GTK just in case it is not
on your system. So it can be done.
Ditto Gimp.

What problems do you have with Gtk on Windows?

Pan is an example of an app that does it well, but not all apps are as
good. It is very hard to build GTK from scratch for Windoze since
there are so many dependencies to chase down. Try picking up GTKv2 for
Windoze ready-built. Even if you can find one will be it be at the
version number you need? Probably not.

-Andrew M.
 
A

Andrew

Is there something wrong with Swing? If you want a cross-platform
solution why not use the cross-platform GUI that comes as part of the
standard API?

I don't like swing. IMO it looks horrible, grappling with stuff having
to be on the EDT is a pain and it is not automatically networked,
unlike X11-based toolkits.
 
L

Lew

Andrew said:
I don't like swing [sic]. IMO it looks horrible,

Look and feel is configurable.
grappling with stuff having to be on the EDT is a pain and

That's common to GUIs, including X11 GUIs, actually. Also, it's
really quite easy to manage the Swing EDT, so it's not a pain at all.
'invokeLater()' and 'SwingWorker' make it soooo easy! I don't know
why anyone regards it as difficult.
it is not automatically networked, unlike X11-based toolkits.

Not sure what you mean by "automatically networked". If Swing is
running on an X11 platform, then you get whatever advantage to X you
want by dint of that. Java itself is an inherently networked
language, so whatever doesn't come the way you want it is easily
programmed to be so.
 
N

Nigel Wade

I don't like swing. IMO it looks horrible,

That's a consequence of being cross-platform. It has to, necessarily,
work at the lowest common denominator of all the supported platforms. The
point is, it's cross-platform, and works the same on all supported
platforms. It really isn't that bad, you've just been corrupted by the
eye-candy and flimsy glossing over of your current desktop, which is
there to mask the horrible mess behind it.
grappling with stuff having
to be on the EDT is a pain

You will have exactly the same problems in any multi-threaded, event
driven (GUI), environment. At least Java/Swing is up front about it.
and it is not automatically networked, unlike
X11-based toolkits.

It is X based on X Windows platforms, it uses the native windowing
environment. If you run an X application on Windows then you would
require an X server running on that same machine for the application to
connect to. You would first have to fire up that X server (Cygwin/X for
example) before your application. That in-built X networking comes at a
cost.
 
A

Andrew

You will have exactly the same problems in any multi-threaded, event
driven (GUI), environment. At least Java/Swing is up front about it.

Actually, no. X11-based toolkits I have used in C++ are message-based
because they are based on X11. Any graphics call basically sends an
X11 protocol message to the X11 server. Such sends are quick. They are
basically asynchronous graphics changes. The apps event loop causes
any changes to get flushed through. Java graphics calls are not
message based. There is no graphics event loop that you have direct
control over. This means that graphics calls have to be made on the
EDT and other non-graphics stuff that would slow things down has to be
shunted off the EDT. Gnome-java looks to me like it would give the
same benefits as the toolkits I am used to since I presume it is based
on GTK underneath, probably via JNI.

-Andrew Marlow
 
N

Nigel Wade

Actually, no.

Really? I disagree.
X11-based toolkits I have used in C++ are message-based
because they are based on X11. Any graphics call basically sends an X11
protocol message to the X11 server. Such sends are quick. They are
basically asynchronous graphics changes.

But that has no bearing on multi-threaded clients. The issue isn't where
the rendering occurs, or how quickly. It's what happens in other threads
in the client whilst events are being processed, and how those other
threads can affect the GUI, and the data displayed by the GUI. The fact
that the X event loop sends a message to another process rather than
doing the rendering itself doesn't really make any difference with regard
to those issues.

The apps event loop causes any
changes to get flushed through. Java graphics calls are not message
based. There is no graphics event loop that you have direct control
over. This means that graphics calls have to be made on the EDT and
other non-graphics stuff that would slow things down has to be shunted
off the EDT.

But in X clients you *have* to control the graphics event loop. It's
yours to manage, and you'd better do it correctly. As I remember it (and
it's over 10 years since I last did any multi-threaded X programming) X
isn't thread-safe in any way whatsoever. Once your program main thread
enters the X event loop your entire program should be controlled by that
thread, and be entirely event driven. If any event handler causes a delay
it will freeze the display just as it will in Swing.

If you start any other threads then those threads shouldn't make X
rendering calls because they are not thread-safe. The best they can do is
push events onto the X event stack, which isn't entirely different from
SwingUtilities.invokeLater. You have to manage all inter-thread
communication and synchronization manually. You get no help from useful
classes such as SwingWorker available in Java.

The basic difference is that X wasn't designed for a multi-threaded
environment whereas Swing was. If you can do everything you want in a
single thread then I presume X will be fine for you. But if you need
multiple threads then you'd better be prepared for some major headaches.
Swing was designed for a multi-threaded environment so you have to take
account of that whether you want threads or not. If you only have a
single thread it's a burden, but if you do need threads then its a
godsend. If you intend to use a multi-threaded client I'd have thought
Swing would be vastly preferable to X.
Gnome-java looks to me like it would give the same benefits
as the toolkits I am used to since I presume it is based on GTK
underneath, probably via JNI.

That sounds like rather a lot of guesswork to me.
 
A

Andrew

Have you tried getting gnome-java to work under Windows in cygwin?

No. I need a solution for MS-Windows that goes native and does so
using the Microsoft compilers, mainly vc8. So I can't use cygwin, nor
even minGW.

-Andrew M.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top