Class: Blanker

Inherits:
Object
  • Object
show all
Defined in:
lib/blanker.rb,
lib/fake_blanker.rb

Constant Summary collapse

JFrame =
javax.swing.JFrame
JLabel =
javax.swing.JLabel

Class Method Summary collapse

Class Method Details

.blank_full_screen!(text) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/blanker.rb', line 27

def self.blank_full_screen! seconds
  if seconds
    @label.set_text "   #{seconds} s" 
  else
    @label.set_text "  Blank section"
  end
  # somewhat hacky work around for doze: http://www.experts-exchange.com/Programming/Languages/Java/Q_22977145.html
  @fr.setAlwaysOnTop(false) 
  @fr.setAlwaysOnTop(true)
  @fr.set_location(0,0)
end

.shutdownObject



44
45
46
# File 'lib/blanker.rb', line 44

def self.shutdown
  @fr.dispose
end

.startupObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/blanker.rb', line 11

def self.startup
  @fr = JFrame.new("blanked section")
  @fr.default_close_operation = JFrame::EXIT_ON_CLOSE
  @fr.set_size(2000, 2000) # ltodo better size coords ?
  
  @label = JLabel.new("  Blank section")
  @fr.add(@label)
  @label.repaint
  @label.revalidate
  
  @fr.set_resizable(false)
  @fr.set_visible(true) # have to do this once, to ever see the thing
  # lodo does this really speed things up to pre-create it? that icon is a bit ugly...
  unblank_full_screen! # and hide it to start
end

.unblank_full_screen!Object



39
40
41
42
# File 'lib/blanker.rb', line 39

def self.unblank_full_screen!
  # off screen...
  @fr.set_location(-2100, -2100)
end