X11 based GUI toolkit for java on unix AND windows

Discussion in 'Java' started by Andrew, Dec 15, 2009.

  1. Andrew

    Andrew Guest

    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
     
    Andrew, Dec 15, 2009
    #1
    1. Advertisements

  2. Andrew

    Nigel Wade Guest

    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.
     
    Nigel Wade, Dec 15, 2009
    #2
    1. Advertisements

  3. Arne Vajhøj, Dec 16, 2009
    #3
  4. Andrew

    abc Guest

    Have you tried getting gnome-java to work under Windows in cygwin?
     
    abc, Dec 16, 2009
    #4
  5. <quote>
    News & Events
    20 December 2006 - Released jwx! 0.0.2-p4
    </quote>

    certainly gives that impression.

    Arne
     
    Arne Vajhøj, Dec 18, 2009
    #5
  6. Andrew

    Andrew Guest

    Andrew, Dec 31, 2009
    #6
  7. Andrew

    Andrew Guest

    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
     
    Andrew, Dec 31, 2009
    #7
  8. Isn't wireshark dependent on Gtk?
    http://www.wireshark.org/docs/wsdg_html_chunked/ChUIGTK.html
    I use Wireshark on Windows.

    Ditto Gimp.

    What problems do you have with Gtk on Windows?
     
    RedGrittyBrick, Dec 31, 2009
    #8
  9. Andrew

    Andrew Guest

    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.
    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.
     
    Andrew, Jan 5, 2010
    #9
  10. Andrew

    Andrew Guest

    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.
     
    Andrew, Jan 5, 2010
    #10
  11. Andrew

    Lew Guest

    Look and feel is configurable.
    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.
    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.
     
    Lew, Jan 5, 2010
    #11
  12. Andrew

    Nigel Wade Guest

    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.
    You will have exactly the same problems in any multi-threaded, event
    driven (GUI), environment. At least Java/Swing is up front about it.
    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, Jan 6, 2010
    #12
  13. Andrew

    Andrew Guest

    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
     
    Andrew, Jan 8, 2010
    #13
  14. Andrew

    Nigel Wade Guest

    Really? I disagree.
    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.

    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.
    That sounds like rather a lot of guesswork to me.
     
    Nigel Wade, Jan 8, 2010
    #14
  15. Andrew

    Andrew Guest

    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.
     
    Andrew, Jan 15, 2010
    #15
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.