Method: ButtonApp#initialize
- Defined in:
- lib/jrubyconf-button.rb
#initialize ⇒ ButtonApp
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) = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH) .set_text(LABELS[0]) .add_selection_listener do new_text = LABELS[(LABELS.index(.text) - 1).abs] .text = new_text end @shell.pack @shell.open end |