Prev: Checked Exceptions
Next: Generics annoyance
From: Nigel Wade on 6 Jan 2010 06:09 On Tue, 05 Jan 2010 15:18:50 -0800, Andrew wrote: > On 15 Dec 2009, 15:28, Nigel Wade <n...(a)ion.le.ac.uk> wrote: >> On Tue, 15 Dec 2009 02:37:54 -0800, Andrew wrote: >> > 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 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. -- Nigel Wade
From: Andrew on 8 Jan 2010 03:31 On 6 Jan, 11:09, Nigel Wade <n...(a)ion.le.ac.uk> wrote: > On Tue, 05 Jan 2010 15:18:50 -0800, Andrew wrote: > > On 15 Dec 2009, 15:28, Nigel Wade <n...(a)ion.le.ac.uk> wrote: > >> On Tue, 15 Dec 2009 02:37:54 -0800, Andrew wrote: > >> > Does anyone know of an X11 GUI toolkit for java that is available on > >> > both unix and windows? > >> Is there something wrong with Swing? > > I don't like swing. IMO it looks horrible, > > 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. 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
From: Nigel Wade on 8 Jan 2010 10:38 On Fri, 08 Jan 2010 00:31:35 -0800, Andrew wrote: > On 6 Jan, 11:09, Nigel Wade <n...(a)ion.le.ac.uk> wrote: >> On Tue, 05 Jan 2010 15:18:50 -0800, Andrew wrote: >> > On 15 Dec 2009, 15:28, Nigel Wade <n...(a)ion.le.ac.uk> wrote: >> >> On Tue, 15 Dec 2009 02:37:54 -0800, Andrew wrote: >> >> > Does anyone know of an X11 GUI toolkit for java that is available >> >> > on both unix and windows? > >> >> Is there something wrong with Swing? > >> > I don't like swing. IMO it looks horrible, > >> > 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. > > 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. -- Nigel Wade
From: Andrew on 15 Jan 2010 02:59
On 16 Dec 2009, 18:04, abc <a...(a)abc.net> wrote: > Andrew wrote: > > 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? 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. |