Hello,
I’d like to use a Swing UI that I’ve built in Netbeans GUI builder in
JRuby, without porting it manually or using Monkeybars. As I’m I newbie
(especially in Java), it might be that the approach is altogether
stupid.
- NewJFrame.java contains the class NewJFRame
- I’ve created a jar from it
- require ‘test/NewJFrame.jar’
include_class Java::test.NewJFrame gives a NameError
other spellings (with or w/o Java::, NewJFrame = Java::…) give the
same error
Can the approach to create a jar containing the class definitions from
the GUI builder and using it in JRuby work at all?
Thank you,
Chris
Hi
you have to supply the class name as a string:
include_class ‘test.NewJFrame’ should work.
Regards
Roger
Am 28.12.2009 um 11:11 schrieb Christian Boehringer:
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Hello,
My apologies, I found the (rather silly) mistake:
NewJFrame.jar was created in a Netbeans Java-Application, by compiling
NewJFrame.java to NewJFrame.class and then converting it to
NewJFrame.jar with jar.
If I create it in Netbeans as a JavaLibrary and have Netbeans do the
rest, it works like a charm.
And now, using Swing in JRuby really is fun.
Bye,
Chris
And now, using Swing in JRuby really is fun.
Bye,
Chris
This is only sort-of related to your post, but I’ve stumbled upon a nice
method for using NetBean’s swing designer with Jruby…
I first create the form or whatever using NetBean’s designer. I make
any
fields I may need to talk to later public instead of private. I usually
name the generated class ‘SomethingFormBase.java’.
On the jruby side, I subclass ‘SomethingFormBase’ with
‘SomethingForm.rb’.
In that file, I put all of my code that responds to events, etc, since
really, ruby makes this so easy. Other jruby classes can easily talk to
this class to get any data needed off of the form.
So, probably an obvious idea, but I find it works well.
I’ve used monkeybars for a NetBeans built swing ui and quickly ran
into some limitations in their MVC approach. For instance, you get one
swing window per controller and they’re singletons. I found I wanted
to open multiple instances of the window. I ended up deleting
monkeybars and writing my own implementation of the bits I was using.
Carl
Sent from my 3G S iPhone. Please disregard the typos or offensive
language.
On Dec 28, 2009, at 12:40 PM, Chuck R. [email protected]
wrote:
If I create it in Netbeans as a JavaLibrary and have Netbeans do the
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Dec 28, 2009, at 9:41 AM, Christian Boehringer wrote:
Hello,
My apologies, I found the (rather silly) mistake:
NewJFrame.jar was created in a Netbeans Java-Application, by compiling
NewJFrame.java to NewJFrame.class and then converting it to
NewJFrame.jar with jar.
If I create it in Netbeans as a JavaLibrary and have Netbeans do the
rest, it works like a charm.
And now, using Swing in JRuby really is fun.
You might want to consider using Monkeybars which wraps Swing using a
reasonably nice ruby DSL.
http://monkeybars.rubyforge.org/
cr
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email