I want to create a Java applet using JRuby. That is, I want to create a Java applet with Ruby code inside run by JRuby to do all the GUI stuff. I am looking for a simple example of how to do this to get started.
我想使用JRuby创建一个Java applet。也就是说,我想用JRuby运行的Ruby代码创建一个Java applet来完成所有的GUI工作。我正在寻找一个简单的例子来说明如何开始这个。
2 个解决方案
#1
7
Check out these links...
看看这些链接......
JRubyApplet from our codebase: https://github.com/jruby/jruby/blob/master/src/org/jruby/JRubyApplet.java
我们的代码库中的JRubyApplet:https://github.com/jruby/jruby/blob/master/src/org/jruby/JRubyApplet.java
Rake tasks for building a signed applet: https://github.com/jruby/jruby/blob/master/rakelib/applet.rake
用于构建签名小程序的Rake任务:https://github.com/jruby/jruby/blob/master/rakelib/applet.rake
Source for jruby.org/tryjruby page: https://github.com/jruby/jruby.github.com/blob/master/www/tryjruby.html
jruby.org/tryjruby页面的来源:https://github.com/jruby/jruby.github.com/blob/master/www/tryjruby.html
For your case, you'd probably have the applet in Java, bootstrap an org.jruby.embed.ScriptingContainer instance, and then feed it the Applet instance so it can add your UI elements in a Ruby script. Anything in the applet jar can be loaded directly, e.g. require 'my_applet.rb' will look for /my_applet.rb in the jar.
对于您的情况,您可能拥有Java中的applet,引导一个org.jruby.embed.ScriptingContainer实例,然后将其提供给Applet实例,以便它可以在Ruby脚本中添加您的UI元素。 applet jar中的任何东西都可以直接加载,例如require'my_applet.rb'将在jar中查找/my_applet.rb。
Enjoy!
#2
0
In addition to the links posted earlier, the following is an example of JRuby in an applet running live: http://www.jruby.org/tryjruby
除了前面发布的链接之外,以下是在实时运行的applet中JRuby的示例:http://www.jruby.org/tryjruby
#1
7
Check out these links...
看看这些链接......
JRubyApplet from our codebase: https://github.com/jruby/jruby/blob/master/src/org/jruby/JRubyApplet.java
我们的代码库中的JRubyApplet:https://github.com/jruby/jruby/blob/master/src/org/jruby/JRubyApplet.java
Rake tasks for building a signed applet: https://github.com/jruby/jruby/blob/master/rakelib/applet.rake
用于构建签名小程序的Rake任务:https://github.com/jruby/jruby/blob/master/rakelib/applet.rake
Source for jruby.org/tryjruby page: https://github.com/jruby/jruby.github.com/blob/master/www/tryjruby.html
jruby.org/tryjruby页面的来源:https://github.com/jruby/jruby.github.com/blob/master/www/tryjruby.html
For your case, you'd probably have the applet in Java, bootstrap an org.jruby.embed.ScriptingContainer instance, and then feed it the Applet instance so it can add your UI elements in a Ruby script. Anything in the applet jar can be loaded directly, e.g. require 'my_applet.rb' will look for /my_applet.rb in the jar.
对于您的情况,您可能拥有Java中的applet,引导一个org.jruby.embed.ScriptingContainer实例,然后将其提供给Applet实例,以便它可以在Ruby脚本中添加您的UI元素。 applet jar中的任何东西都可以直接加载,例如require'my_applet.rb'将在jar中查找/my_applet.rb。
Enjoy!
#2
0
In addition to the links posted earlier, the following is an example of JRuby in an applet running live: http://www.jruby.org/tryjruby
除了前面发布的链接之外,以下是在实时运行的applet中JRuby的示例:http://www.jruby.org/tryjruby