Sha256: a5a87d2243402f7b7c4206979e55a110440983fc9f45a84623c53bb96286a9c2

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents


class Blanker 
  
  if RUBY_PLATFORM =~ /java/
    require 'java'
    JFrame = javax.swing.JFrame
    JPanel = javax.swing.JPanel
  
    def self.blank_full_screen!
      # a new screen each time as other jruby doesn't terminate as gracefully as we would like...
        frame = JFrame.new("Edited!") # ltodo take out...
        frame.default_close_operation = JFrame::EXIT_ON_CLOSE
        frame.set_location(0,0)
        frame.set_size(2000, 2000) # ltodo better coords...
        frame.show
        # lodo on top?
        
        fr = frame
        fr.set_resizable(false)
        
        fr.set_undecorated(true) unless fr.is_displayable
        
        # probably unnecessary
        panel = JPanel.new
        frame.add(panel)
        # frame.set_background()
        panel.repaint
        panel.revalidate
        # too heavy!
        # gd = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
        # gd.set_full_screen_window(fr)
        @fr = fr
        @fr.set_visible(true)
    end
  else
    
    def self.blank_full_screen!
      puts 'the screen is now...blank!'      
    end
  
  end
  
  def self.unblank_full_screen!
    if RUBY_PLATFORM =~ /java/
      if @fr
        @fr.dispose
      end
    else
      puts 'the screen is now...visible!'
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sensible-cinema-0.7.0 lib/blanker.rb
sensible-cinema-0.6.1 lib/blanker.rb
sensible-cinema-0.6.0 lib/blanker.rb