Forum: JRuby JRubyFX simple EventHandler

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B97f192e676f1a67e0ef18f022671406?d=identicon&s=25 Rodrigo Botafogo (Guest)
on 2015-05-11 17:12
(Received via mailing list)
Hello…

I´m trying to write a very simple JRubyFX application with an
EventHandler.
My code now:

require 'jrubyfx'

class HelloWorldApp < JRubyFX::Application

  def start(stage)

    with(stage, title: "Hello World!", width: 800, height: 600) do
      layout_scene do
        button("Click me")
        # button.setOnAction(new Bt_Action)
      end
    end

    stage.show # Tip: most of the time, () can be removed from method
calls

  end

end

Is it possible to write a button.setOnAction without writing a FXML
file?


Thanks
​
13313ac2ec7ba7c43b1b952db034ff3b?d=identicon&s=25 Thomas E Enebo (Guest)
on 2015-05-11 17:48
(Received via mailing list)
require 'jrubyfx'

class HelloWorldApp < JRubyFX::Application
  def start(stage)
    with(stage, title: "Hello World!", width: 800, height: 600) do
      layout_scene do
        button("Click me") do
          set_on_action { |e|  puts "PRESSED" }
        end
      end
    end.show
  end
end

HelloWorldApp.launch


On Mon, May 11, 2015 at 10:10 AM, Rodrigo Botafogo <
B97f192e676f1a67e0ef18f022671406?d=identicon&s=25 Rodrigo Botafogo (Guest)
on 2015-05-11 19:15
(Received via mailing list)
Thanks....

2015-05-11 12:47 GMT-03:00 Thomas E Enebo <tom.enebo@gmail.com>:
B97f192e676f1a67e0ef18f022671406?d=identicon&s=25 Rodrigo Botafogo (Guest)
on 2015-05-11 22:01
(Received via mailing list)
One more simple question... in this code, how do I add a Layout Panel to
it?

Thanx...

2015-05-11 12:47 GMT-03:00 Thomas E Enebo <tom.enebo@gmail.com>:
This topic is locked and can not be replied to.