Last active
August 29, 2015 14:20
-
-
Save supermomonga/50b8c78064af82ea631c to your computer and use it in GitHub Desktop.
JRubyFXでコンストラクタに引数を渡しつつControllerを切り替える ref: http://qiita.com/supermomonga/items/20464ed426c7e4bdb7a4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController | |
include JRubyFX::Controller | |
def move klass, *args | |
@stage.fxml klass, initialize: args | |
@stage.show | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BarController < ApplicationController | |
def initialize arg | |
puts "I got `#{arg}` as a constructor argument!" | |
end | |
def click_button | |
move FooController, "Hello, Foo!" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FooController < ApplicationController | |
def initialize arg | |
puts "I got `#{arg}` as a constructor argument!" | |
end | |
def click_button | |
move BarController, "Hello, Bar!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment