Non-Java Related jRuby GUI Builder

I’ve been looking for a set of tools for rapid GUI development in jRuby
and everywhere I look, I get Swing, AWT and other Java-related tools. I
learnt jRuby coz I was pretty much fed up with the excessively verbose
Java code that made programming a chore. The last thing I want to do is
look at it again while coding in ruby code.

Does anyone have any suggestions for jRuby GUI development tools that do
NOT include Swing, AWT or other Java-related stuff? I don’t need a
native look and feel, just the ability to add my own images as buttons
and customize the UI elements using images.

Have you tried MigLayout which (IMHO) makes Swing usable.

…R

Limelight comes to mind , see here;

http://limelight.8thlight.com/

Charles M.
[email protected]

Keith:

I know, it seemed to be that the op was looking for non-Swing i.e. not
the usual Java GUI development framework.

I’m not pushing it and I agree with your assessment.

Thanks for the links on the Jruby Swing example.

Charles

Keith:

Can you think of any examples that uses Jruby’s Swing API but does that
in the context of the output generated by a GUI design tools like IDEA’s
GUI Builder ?

thanks

Charles

Charles, Limelight is interesting – althoughI just looked at it
briefly, it looks good. It is written in Java, though it looks like
it provides a Ruby wrapper around its Java.

Farsheed, that said, if the development you’re doing is for something
serious (that is, multiple users and an expected multiyear lifetime with
future upgrades), then I think you’d do better with something more
established. I believe Limelight hasn’t been updated in 8 months
(https://github.com/slagyr/limelight), and though there’s nothing wrong
with that, it could, for example, eventually become out of date with
respect to a new version of Java, JRuby, etc.

However, please be aware that just because Java code is verbose doesn’t
mean that the Ruby code calling it needs to be. I have an example of a
JRuby Swing program here:

Github repo:
https://github.com/keithrbennett/life_game_viewer

Blog article:
http://www.bbs-software.com/blog/2012/09/05/conways-game-of-life-viewer/

This fileprobably has the most Swing library interaction:
https://github.com/keithrbennett/life_game_viewer/blob/master/lib/life_game_viewer/view/life_game_viewer_frame.rb

Thanks to JRuby, the code there isn’t that much worse than code using a
Ruby library would be.

I spent several years doing Java Swing development, andmy take on it is
it’s a very powerful library, but it’s complex, with a steep learning
curve. Complex UI products like NetBeans and the Intellij IDE’s such as
RubyMine use it. Forget AWT, it’s ancient, and worse. SWT, maybe; I
only looked at it briefly once, and thought it to be less fully featured
than Swing.

This page lists some GUI frameworks for Ruby:
https://www.ruby-toolbox.com/categories/GUI_Frameworks. There’s an FFI
wrapper around Tk – that might be an option for you – I think Tk is
far less complex than Swingor SWT.

  • Keith

Keith R. Bennett
http://about.me/keithrbennett

Charles -

To be honest, I’ve never used a GUI builderfor Swing. I have no idea
what their output is. So I don’t know of any examples. I’m a bit
suspicious of GUI builders, believing they may nurture bad habits, such
as the production of monolithic and complex frames that defy reuse.
That’s probably an invalid prejudice based on GUI builders I used that
predated Swing, though.

Unless it’s a trivial UI, you’ll want to reuse panels, both to save you
work, and for look and feel consistency. So be careful how you use them
– it’s easy to be tempted to do an entire frame in one step, but there
may be cases where you would be better off creating individual panelsby
themselves, and then assembling them either in code, or in the GUI
builder, if that is possible.

  • Keith

Keith R. Bennett
http://about.me/keithrbennett

We are still actively developing JRubyFX but you can use JavaFX scene
builder:

http://www.oracle.com/technetwork/java/javafx/tools/index.html

This will create a FXML file of the layout you made and then you can
attach
controllers to it for behavior. JRubyFX can be found here:

https://github.com/jruby/jrubyfx

There is an example showing this in the repo…

-Tom

Very interesting

Is there a roadmap for the project ? I’ll scan git but I trust that I
will be able to understand what the current limitations are.

thanks

Charles

Keith:

thanks, I have been spoiled I’m afraid. I have been using GUI builders
in VisualWorks Smalltalk since 94 and they do allow you to create
reusable components which is well supported and encouraged.
Again, i totally agree with your advise and it may be the case that the
IDEA GUI builder and or Swing combo make it hard to create reusable
components via the builder. I hope that’s not the case.

I suppose that the GUI builder will generated a class or set of classes
so perhaps its just a matter of requiring said file into one’s Ruby
project and then creating in Jruby the callback implementations for the
various listeners. Perhaps the IDEA team has examples of that somewhere.

Charles

There is not a roadmap, but I can mention a few things which are still
happening:

  • Fxml support has been in flux recently but I think it should be fairly
    stable now. byteit101 has been working on that and it would be what you
    would consume from the RAD tool. Jumping on now will help shake out any
    issues with FXML support. He is using it for a complex GUI.
  • DSL API which can work in conjunction with Fxml is filling out method
    signatures which are missing parameter helpers. Parameter helpers allow
    us
    to specify things like ‘fill= :red’ instead of ‘fill = Color.new(…)’.
    We
    have these on most of the popular FX types but we need to make them for
    all
    types.
  • Speeding up load time. byteit101 also has a branch which loads
    fast(er)
    now. loadtime is an ever-present work item for JRuby in general :slight_smile:

So, it is a project where many things work and there are still plenty of
unfinished aspects.

-Tom

Tom -

Can you tell us anything about JavaFX in general? Do you like it? Is it
a good framework? (I guess they all have their issues, so my question
should really be “is it better than the others?”.)

I found this information page on FX, if anyone’s interested:

http://www.oracle.com/technetwork/java/javafx/overview/index.html

  • Keith

Keith R. Bennett
http://about.me/keithrbennett

I take JavaFX as the Swing replacement these days and I think if you are
interesting in a rich GUI then JavaFX has more to offer over Swing. As
such, frameworks like Moneybars could be retrofitted to also target FX
controls. So don’t think of JavaFX as being as much a new framework as
a
new set of components/controls.

The obvious nice things about FX is how easy it is to get a polished
visual
effect. Or how easy it is to make non-rectangular windows. If you
couple
this with the fact that stylesheets are baked into the system then you
can
write a program once and restyle it without changing code. A lot of
refinements over what Swing provides.

JRubyFX (and any other language binding like GroovyFX) typically makes
using the library nicer since they all layer on their idiomatic patterns
on
the API. In JRubyFX, programatically we have a DSL for simpler scene
layout. JavaFX also provides FXML as a mechanism for storing a scene
layout as data (typically generated using a RAD tool) which generally
will
be used for more complex layouts. JRubyFX can pull in these XML files
and
use them in a natural way.

-Tom

Thanks for the responses, everyone. JavaFX does look promising, although
I haven’t used it and sincerely hope it isn’t as user unfriendly as
everything else Java has made.

I’m curious to know how a person using Ruby (not jRuby) would go about
developing desktop applications. This is not so much because I want to
know about how Ruby actually achieves this but more because I would like
to know what it would use other than Java-based technologies. I’m not
sure why all the jRuby UI development tools are Java-centric. What does
Ruby, which cannot use these, do and can this also be used for jRuby?
This would enable developers to easily switch between Ruby and jRuby
without needing to learn or use a different technology in each case.

Farsheed -

I think it’s because almost all user facing apps written these days are
web
or mobile apps – very few are desktop apps.

Try looking for a job coding in Ruby that’s not a Rails job and you’ll
know
what I mean. :wink:

Back when Java became popular, they were still writing a lot of desktop
client apps, and a desktop GUI library was quite important. Not so much
anymore.

  • Keith

That makes sense, Keith. Would you know what Ruby (not jRuby) does in
case of a thick client application? Something more on the lines of a
fullscreen multiplayer game rather than a browser-based application.

A great native GUI library for Ruby is Shoes, http://shoesrb.com/. I
don’t know if Shoes is appropriate for game development.

I seem to remember talk of a JRuby version of Shoes, but I’m not finding
it in a too quick search.

Bruce A. wrote in post #1108591:

A great native GUI library for Ruby is Shoes, http://shoesrb.com/. I
don’t know if Shoes is appropriate for game development.

I seem to remember talk of a JRuby version of Shoes, but I’m not finding
it in a too quick search.

Purple Shoes, perhaps?:

https://github.com/ashbb/purple_shoes

I don’t really know what you’d use for MRI Ruby. I guess you could
access
the low level OS calls if you wanted to, but I imagine that would be a
lot
of work, and nonportable.

If you’re writing games, I do know that Java has a 3D library, and you
could drive that from JRuby if you wanted to. At least you’d be
OS-portable. That would be low level too though. There may be libraries
available to wrap some of that complexity for you, I don’t know.

If you can find a C library, then you could probably find a way to drive
it
from MRI Ruby.

  • Keith

Hi … I had experiment with Qt and theres a way to integrate Nokias
Wysiwyg tool and a translator to Ruby… but i thinks on this on MRI and
sure this will give you more that one headache… first i choose Jruby
thinking on portability … Also a solution for GUI that nots include
Java
need a 3rd party lib to makes it run… This must require aditional work
on
deploy or event on develop stations day to day … All this troubles and
works hours are reduced using Java that let you run Jruby itself. The
Gui
libs are ready to be used and its crossplatform. After a lots on thinks
hours i find that this is one of the reasons because all Ruby Gui tries
are
on that way…and take it as one of the better for mines… Regards
El 11/05/2013 20:12, “Bruce A.” [email protected] escribi:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs