Method: ButtonApp#initialize

Defined in:
lib/jrubyconf-button.rb

#initializeButtonApp

Returns a new instance of ButtonApp.



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

def initialize
  display = Swt::Widgets::Display.get_current
  @shell = Swt::Widgets::Shell.new
  @shell.setLayout(Swt::Layout::FillLayout.new)
  
  button = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH)
  button.set_text(LABELS[0])
  button.add_selection_listener do
    new_text = LABELS[(LABELS.index(button.text) - 1).abs]
    button.text = new_text
  end
  
  @shell.pack
  @shell.open
end