Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env jruby
require 'jrubyfx'
class MyApp < JRubyFX::Application
def init
puts "called init"
params = getParameters
puts params.nil?
require 'jrubyfx'
class FooApp < JRubyFX::Application
def initialize()
super()
@bar = 1
@spam = "ham"
end
def start(stage)
# See: http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
require 'jrubyfx'
require 'open-uri'
class FirstLineURLTask < Java::javafx.concurrent.Task
def initalize(url)
@url = url
end
# See http://docs.oracle.com/javafx/2/collections/jfxpub-collections.htm
require 'jrubyfx'
# Example for an ObservableList
list = []
observable_list = FXCollections.observable_list(list)
observable_list.add_change_listener do
puts "Detected a change!"
end
# See: http://docs.oracle.com/javafx/2/binding/jfxpub-binding.htm
require 'jrubyfx'
class MyDoubleBinding < Java::javafx.beans.binding.DoubleBinding
def initialize(a, b, c, d)
@a, @b, @c, @d = a, b, c, d
super()
bind(@a, @b, @c, @d)
end
require 'java'
require 'jrubyfx'
JavaFX = Java::javafx
class FormApp < JRubyFX::Application
def start(stage)
stage.set_title("JavaFX Welcome")
grid = JavaFX::scene.layout.GridPane.new
@komax
komax / ir_dumper.rb
Last active December 19, 2015 02:58
Pretty Printer for current Intermediate Representation (IR)
#!/usr/bin/env jruby
require 'jruby'
def get_ast(code)
JRuby.parse(code)
end
def get_ir(ast_node)
ir_manager = JRuby::runtime.ir_manager
ir_manager.dry_run = true