class HelloButton

Public Class Methods

new() click to toggle source
# File samples/hello/hello_button2.rb, line 14
def initialize
  @counter = Counter.new

  observe(@counter, :count) do |new_count|
    @button.text = "Click To Increment: #{new_count}"
  end
end

Public Instance Methods

launch() click to toggle source
# File samples/hello/hello_button2.rb, line 22
def launch
  jframe('Hello, Button!') {
    @button = jbutton('Click To Increment: 0') {
      on_action_performed do
        @counter.count += 1
      end
    }
  }.show
end