Skip to content
Browse files

better binary

  • Loading branch information...
1 parent c86329d commit 39be67fb0d2e532a25915c324335c049f74106cd @rdp committed Oct 12, 2012
Showing with 16 additions and 4 deletions.
  1. +3 −3 bin/simple_gui_creator
  2. +13 −1 lib/simple_gui_creator/swing_helpers.rb
View
6 bin/simple_gui_creator
@@ -13,7 +13,7 @@ if !OS.jruby?
exit 1
end
-require 'simple_gui_creator'#File.dirname(__FILE__) + "/../lib/simple_gui_creator.rb"
+require File.dirname(__FILE__) + "/../lib/simple_gui_creator.rb"
class TestWindow < SimpleGuiCreator::ParseTemplate
@@ -22,7 +22,7 @@ class TestWindow < SimpleGuiCreator::ParseTemplate
string = <<-EOL
---------- Simple Ruby Gui Creator Test Window ----------------------------------------
| "Edit this, then..." |
- | [Test it out! :test_it_out_button] [Insert code for this window:replace_button] |
+ | [Test it out! :test_it_out_button] |
| [ :text_area_to_use, width=70chars, height=500, font=fixed_width] |
| [ ] |
| [ ] |
@@ -32,7 +32,7 @@ class TestWindow < SimpleGuiCreator::ParseTemplate
| [ ] |
| [ ] |
| |
- | [Create code snippet :create_snippet] |
+ | [Create code snippet :create_snippet] [Insert code for this window:replace_button] |
---------------------------------------------------------------------------------------
EOL
parse_setup_string string
View
14 lib/simple_gui_creator/swing_helpers.rb
@@ -5,7 +5,7 @@ module SimpleGuiCreator
include_package 'javax.swing'
# and use these constants (bug: http://jira.codehaus.org/browse/JRUBY-5107)
[JProgressBar, JButton, JLabel, JPanel, JOptionPane,
- JFileChooser, JComboBox, JDialog, SwingUtilities, JFrame, JSlider, JPasswordField, JCheckBox, UIManager]
+ JFileChooser, JComboBox, JDialog, SwingUtilities, JFrame, JSlider, JPasswordField, JCheckBox, AbstractButton, UIManager]
include_package 'java.awt'; [Font, FileDialog]
@@ -270,4 +270,16 @@ def on_clicked &block
end
+ class AbstractButton # like JCheckBox, et al
+
+ def disable!
+ setEnabled(false)
+ end
+
+ def enable!
+ setEnabled(true)
+ end
+
+ end
+
end

0 comments on commit 39be67f

Please sign in to comment.
Something went wrong with that request. Please try again.