JRubyFX simple EventHandler


#1

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


#2

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 B. <


#3

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 removed_email_address@domain.invalid:


#4

Thanks…

2015-05-11 12:47 GMT-03:00 Thomas E Enebo removed_email_address@domain.invalid: