Packaging JRuby Swing app using Profligacy into a .jar

On Jul 28, 7:01 pm, “Vladimir S.” [email protected] wrote:

Hi Chris,

Maybe this article by Matt Fletcher would be of help:http://
spin.atomicobject.com/2008/07/02/rolling-a-jruby-desktop-appli

Thanks,
–Vladimir

Thanks Vladimir,

I did see that article earlier, but had trouble making it work for
myself. Anyway, I persevered and got it working. Thanks also to Matt
for posting the article.

Regards,

Chris
http://smuby.org

I’m doing some graphics programming using JOGL and Java3D, and I have
some Java methods that requires double (ie double datatype) arguments.

However, when I just specify a normal floating point value (e.g 3.7),
it doesn’t appear as if the literal gets coersed correctly. Is there a
simple way way to forcibly specify a literal as a double within jruby?

many thanks,
-john c.

ps.

In the Java3D code below, the call to BoundingSphere.new() doesn’t seem
to work properly, with the second argument being a double, and which the
call doesn’t seem to pick up correctly.

require ‘java’

include_class ‘javax.media.j3d.Canvas3D’
include_class ‘javax.media.j3d.BranchGroup’
include_class ‘javax.media.j3d.BoundingSphere’
include_class ‘javax.media.j3d.DirectionalLight’

include_class ‘javax.vecmath.Color3f’
include_class ‘javax.vecmath.Point3d’
include_class ‘javax.vecmath.Vector3f’

include_class ‘com.sun.j3d.utils.geometry.ColorCube’
include_class ‘com.sun.j3d.utils.geometry.Sphere’
include_class ‘com.sun.j3d.utils.universe.SimpleUniverse’

class GuiDisplay
def initialize

     universe = SimpleUniverse.new()
     group = BranchGroup.new()
     group.addChild(Sphere.new(0.5))

     light1Color = Color3f.new(1.8, 0.1, 0.1)
     light1Direction = Vector3f.new(4.0, -7.0, -12.0)
     bounds = BoundingSphere.new(Point3d.new(0.0,0.0,0.0), 100.0)
     light1 = DirectionalLight.new(light1Color, light1Direction)
     light1.setInfluencingBounds(bounds)
     group.addChild(light1)

     universe.getViewingPlatform().setNominalViewingTransform()
     universe.addBranchGraph(group)
 end

end


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Jul 30, 2008 at 10:46 AM, john casu [email protected] wrote:

I’m doing some graphics programming using JOGL and Java3D, and I have some
Java methods that requires double (ie double datatype) arguments.

However, when I just specify a normal floating point value (e.g 3.7), it
doesn’t appear as if the literal gets coersed correctly. Is there a simple
way way to forcibly specify a literal as a double within jruby?

We don’t have a nice, syntactic sugar-filled way of doing this right
now, but you can fall back to this:

java.lang.Double.new(3.7)

which should get used/converted to a double primitive when it comes
time to select a method.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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