edubkendo
3/30/2013 - 4:16 AM

charcount.rb

require 'jrubyfx'

class CharCountApp < JRubyFX::Application
  def start(stage)
    stage.title = "Character Counter"

    CharCountController.new("chararea.fxml", stage, fill: :grey)
    stage.show
  end
end

class CharCountController
  include JRubyFX::Controller

  def initialize
   @chars =  count_txt
   @char_count = count_label

    #use addListener instead
    @chars.text_property.addListener do |obs, oval, nval|
       @char_count.text = @chars.text.length.to_s
    end
  end
end


CharCountApp.launch