Sha256: f89541b753a0a6013073217330100f82d3ed3f43acb8963e846560a6e48ebe4e

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

require 'rubygems'
require 'sane'
require_relative '../lib/swing_helpers'

module SensibleSwing

class MainWindow < JFrame

  def initialize
    super "countdown"
      set_size 150,100
      setDefaultCloseOperation JFrame::EXIT_ON_CLOSE # happiness
      @jlabel = JLabel.new 'Welcome to Sensible Cinema!'
      happy = Font.new("Tahoma", Font::PLAIN, 11)
      @jlabel.setFont(happy)
      @jlabel.set_bounds(44,44,160,14)
      panel = JPanel.new
      @panel = panel
      @buttons = []
      panel.set_layout nil
      add panel # why can't I just slap these down?
      panel.add @jlabel
      @start_time = Time.now
      @jlabel.set_text 'welcome...'
      Thread.new { sleep 1; @jlabel.set_text 'yo3'}
      
      @switch_image_timer = javax.swing.Timer.new(1000, nil) # nil means it has no default person to call when the action has occurred...
      @switch_image_timer.add_action_listener do |e|
        seconds_left = (ARGV[0] || '25').to_i*60 - (Time.now - @start_time)
        @jlabel.set_text "%02d:%02d" % [seconds_left/60, seconds_left % 60]
      end
      @switch_image_timer.start
      self.always_on_top=true
  end
  
  end

  MainWindow.new.show

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sensible-cinema-0.24.1 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.24.0 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.6 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.5 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.4 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.3 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.2 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.1 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.23.0 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.22.1 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.22.0 lib/count_down_timer_jruby_swing.rb
sensible-cinema-0.21.10 lib/count_down_timer_jruby_swing.rb