jrubyconf-button 4-java → 5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jrubyconf-button.rb +30 -0
  2. metadata +2 -1
@@ -0,0 +1,30 @@
1
+
2
+ require 'java'
3
+ require 'rubygems'
4
+ require 'swt'
5
+
6
+ class ButtonApp
7
+ attr_reader :shell
8
+
9
+ LABELS = ["Drink Me", "Eat Me"]
10
+
11
+ def initialize
12
+ display = Swt::Widgets::Display.get_current
13
+ @shell = Swt::Widgets::Shell.new
14
+ @shell.setLayout(Swt::Layout::FillLayout.new)
15
+
16
+ button = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH)
17
+ button.set_text(LABELS[0])
18
+ button.add_selection_listener do
19
+ new_text = LABELS[(LABELS.index(button.text) - 1).abs]
20
+ button.text = new_text
21
+ end
22
+
23
+ @shell.pack
24
+ @shell.open
25
+ end
26
+
27
+ def close
28
+ @shell.dispose
29
+ end
30
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jrubyconf-button
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "4"
5
+ version: "5"
6
6
  platform: java
7
7
  authors:
8
8
  - Daniel Lucraft
@@ -38,6 +38,7 @@ files:
38
38
  - features/button.feature
39
39
  - features/step_definitions/button_steps.rb
40
40
  - features/support/env.rb
41
+ - lib/jrubyconf-button.rb
41
42
  has_rdoc: true
42
43
  homepage: ""
43
44
  licenses: []