swing_paradise 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of swing_paradise might be problematic. Click here for more details.

Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1557 -0
  3. data/doc/README.gen +1510 -0
  4. data/lib/swing_paradise/autoinclude.rb +3 -0
  5. data/lib/swing_paradise/awt/README.md +1 -0
  6. data/lib/swing_paradise/awt/color.rb +45 -0
  7. data/lib/swing_paradise/base_module/base_module.rb +993 -0
  8. data/lib/swing_paradise/classes +1 -0
  9. data/lib/swing_paradise/examples/001_quit_button_example.rb +55 -0
  10. data/lib/swing_paradise/examples/002_text_area_example.rb +55 -0
  11. data/lib/swing_paradise/examples/003_combo_box_example.rb +57 -0
  12. data/lib/swing_paradise/examples/004_jpanel_left_bound_example.rb +41 -0
  13. data/lib/swing_paradise/examples/005_box_layout_example.rb +39 -0
  14. data/lib/swing_paradise/examples/006_frame_example.rb +33 -0
  15. data/lib/swing_paradise/examples/007_textarea_responding_to_enter_key_example.rb +28 -0
  16. data/lib/swing_paradise/examples/008_scrolled_window_example.rb +41 -0
  17. data/lib/swing_paradise/examples/009_font_size_example.rb +39 -0
  18. data/lib/swing_paradise/examples/010_counter_example.rb +183 -0
  19. data/lib/swing_paradise/examples/011_button_with_image_example.rb +58 -0
  20. data/lib/swing_paradise/examples/012_quit_on_escape_key_being_pressed.rb +37 -0
  21. data/lib/swing_paradise/examples/013_simple_box_example.rb +38 -0
  22. data/lib/swing_paradise/examples/014_mouse_events_example.rb +41 -0
  23. data/lib/swing_paradise/examples/015_menu_example.rb +77 -0
  24. data/lib/swing_paradise/examples/016_file_chooser_example.rb +96 -0
  25. data/lib/swing_paradise/examples/017_buttons_example.rb +56 -0
  26. data/lib/swing_paradise/examples/018_colour_chooser_example.rb +51 -0
  27. data/lib/swing_paradise/examples/019_jeditorpane_example.rb +61 -0
  28. data/lib/swing_paradise/examples/020_table_example.rb +77 -0
  29. data/lib/swing_paradise/examples/021_jsplitpane_example.rb +66 -0
  30. data/lib/swing_paradise/examples/022_drawing_oval_example.rb +51 -0
  31. data/lib/swing_paradise/examples/023_show_message_dialog_example.rb +57 -0
  32. data/lib/swing_paradise/java_classes/border_factory/border_factory.rb +19 -0
  33. data/lib/swing_paradise/java_classes/box/box.rb +72 -0
  34. data/lib/swing_paradise/java_classes/button +1 -0
  35. data/lib/swing_paradise/java_classes/checkbox +1 -0
  36. data/lib/swing_paradise/java_classes/combobox +1 -0
  37. data/lib/swing_paradise/java_classes/default_table_model/default_table_model.rb +18 -0
  38. data/lib/swing_paradise/java_classes/frame +1 -0
  39. data/lib/swing_paradise/java_classes/jbutton/jbutton.rb +199 -0
  40. data/lib/swing_paradise/java_classes/jcheckbox/jcheckbox.rb +28 -0
  41. data/lib/swing_paradise/java_classes/jcombobox/jcombobox.rb +31 -0
  42. data/lib/swing_paradise/java_classes/jcomponent/jcomponent.rb +253 -0
  43. data/lib/swing_paradise/java_classes/jeditorpane/jeditorpane.rb +23 -0
  44. data/lib/swing_paradise/java_classes/jfilechooser/jfilechooser.rb +22 -0
  45. data/lib/swing_paradise/java_classes/jframe/jframe.rb +319 -0
  46. data/lib/swing_paradise/java_classes/jlabel/jlabel.rb +171 -0
  47. data/lib/swing_paradise/java_classes/jmenu/jmenu.rb +13 -0
  48. data/lib/swing_paradise/java_classes/jmenubar/jmenubar.rb +13 -0
  49. data/lib/swing_paradise/java_classes/jpanel/jpanel.rb +115 -0
  50. data/lib/swing_paradise/java_classes/jscrollpane/jscrollpane.rb +84 -0
  51. data/lib/swing_paradise/java_classes/jspinner/jspinner.rb +17 -0
  52. data/lib/swing_paradise/java_classes/jtextarea/jtextarea.rb +120 -0
  53. data/lib/swing_paradise/java_classes/jtextfield/jtextfield.rb +314 -0
  54. data/lib/swing_paradise/java_classes/label +1 -0
  55. data/lib/swing_paradise/java_classes/panel +1 -0
  56. data/lib/swing_paradise/java_classes/spinner +1 -0
  57. data/lib/swing_paradise/java_classes/textarea +1 -0
  58. data/lib/swing_paradise/misc/misc.rb +57 -0
  59. data/lib/swing_paradise/prototype/prototype.rb +79 -0
  60. data/lib/swing_paradise/requires/require_the_project.rb +15 -0
  61. data/lib/swing_paradise/toplevel_methods/misc.rb +293 -0
  62. data/lib/swing_paradise/version/version.rb +17 -0
  63. data/lib/swing_paradise/widget_collection/README.md +2 -0
  64. data/lib/swing_paradise/widget_collection/text_viewer.rb +160 -0
  65. data/lib/swing_paradise.rb +1 -0
  66. data/swing_paradise.gemspec +42 -0
  67. metadata +120 -0
@@ -0,0 +1,72 @@
1
+ # =========================================================================== #
2
+ # require 'swing_paradise/java_classes/box/box.rb'
3
+ # =========================================================================== #
4
+ # java_import 'javax.swing.Box'
5
+ # =========================================================================== #
6
+ # Documentation for class Box can be found here:
7
+ #
8
+ # https://docs.oracle.com/javase/8/docs/api/javax/swing/Box.html
9
+ #
10
+ # =========================================================================== #
11
+ class Java::JavaxSwing::Box
12
+
13
+ alias << add # === <<
14
+
15
+ # ========================================================================= #
16
+ # === maximal
17
+ #
18
+ # This has to be a method rather than an alias, due to the second
19
+ # argument, which is optional.
20
+ # ========================================================================= #
21
+ def maximal(
22
+ this_widget,
23
+ optional_padding = 0
24
+ )
25
+ if optional_padding > 0
26
+ i = optional_padding
27
+ setBorder(
28
+ BorderFactory.createEmptyBorder(i, i, i, i)
29
+ )
30
+ end
31
+ add(this_widget)
32
+ end
33
+
34
+ # ========================================================================= #
35
+ # === is_padded
36
+ # ========================================================================= #
37
+ def is_padded(i = 4)
38
+ i = i.to_i
39
+ getRootPane.setBorder(
40
+ BorderFactory.createEmptyBorder(i, i, i, i)
41
+ )
42
+ end
43
+
44
+ # ========================================================================= #
45
+ # === minimal
46
+ #
47
+ # The second parameter is currently not in use.
48
+ # ========================================================================= #
49
+ def minimal(
50
+ widget,
51
+ optional_padding = 0
52
+ )
53
+ add(widget)
54
+ end
55
+
56
+ # ========================================================================= #
57
+ # === horizontal_center
58
+ # ========================================================================= #
59
+ def horizontal_center
60
+ setAlignmentX(
61
+ Component::CENTER_ALIGNMENT
62
+ )
63
+ end
64
+
65
+ # ========================================================================= #
66
+ # === show_all
67
+ # ========================================================================= #
68
+ def show_all
69
+ setVisible(true)
70
+ end
71
+
72
+ end
@@ -0,0 +1 @@
1
+ jbutton
@@ -0,0 +1 @@
1
+ jcheckbox
@@ -0,0 +1 @@
1
+ jcombobox
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # 'default_table_model.rb'
6
+ # =========================================================================== #
7
+ class Java::JavaxSwingTable::DefaultTableModel
8
+
9
+ # ========================================================================= #
10
+ # === columns
11
+ # ========================================================================= #
12
+ def columns(*i)
13
+ i.flatten.each {|entry|
14
+ add_column(entry.to_s)
15
+ }
16
+ end
17
+
18
+ end
@@ -0,0 +1 @@
1
+ jframe
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'swing_paradise/java_classes/jbutton/jbutton.rb'
6
+ # =========================================================================== #
7
+ java_import javax.swing.JButton
8
+
9
+ class Java::JavaxSwing::JButton
10
+
11
+ alias original_set_font set_font # === original_set_font
12
+
13
+ alias text? getText # === text?
14
+
15
+ # ========================================================================= #
16
+ # === keycombo
17
+ #
18
+ # Usage example:
19
+ #
20
+ # button.keycombo('Alt+1')
21
+ #
22
+ # ========================================================================= #
23
+ def keycombo(i = 'Alt+1')
24
+ if i.is_a? String
25
+ if i.include? '+'
26
+ splitted = i.split('+')
27
+ case splitted[0]
28
+ when 'Alt'
29
+ i = Object.const_get('KeyEvent::VK_'+splitted[1].to_s)#.to_sym
30
+ end
31
+ else
32
+ e 'The given input must contain a "+" character.'
33
+ end
34
+ end
35
+ setMnemonic(i)
36
+ end
37
+
38
+ # ========================================================================= #
39
+ # === do_reveal
40
+ # ========================================================================= #
41
+ def do_reveal
42
+ setVisible(true)
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === do_focus (focus tag)
47
+ # ========================================================================= #
48
+ def do_focus
49
+ requestFocusInWindow()
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === on_hover
54
+ # ========================================================================= #
55
+ def on_hover(
56
+ use_this_colour = :steelblue
57
+ )
58
+ # getModel.addChangeListener {|event|
59
+ # pp event
60
+ # pp event.class
61
+ # }
62
+ addMouseListener {|entry|
63
+ pp entry.class
64
+ }
65
+ # (new java.awt.event.MouseAdapter() {
66
+ # public void mouseEntered(java.awt.event.MouseEvent evt) {
67
+ # setBackground(Color.GREEN);
68
+ # }
69
+ # public void mouseExited(java.awt.event.MouseEvent evt) {
70
+ # setBackground(UIManager.getColor("control"));
71
+ # }
72
+ end
73
+
74
+ # ========================================================================= #
75
+ # === set_size_request
76
+ # ========================================================================= #
77
+ def set_size_request(
78
+ a = 50,
79
+ b = 50
80
+ )
81
+ setPreferredSize(Dimension.new(a, b))
82
+ end; alias width_height set_size_request # === width_height
83
+
84
+ # ========================================================================= #
85
+ # === Support more flexible tooltips next
86
+ #
87
+ # Enable: panel.hint=
88
+ # ========================================================================= #
89
+ alias hint= setToolTipText # === hint=
90
+ alias tooltip= setToolTipText # === tooltip=
91
+
92
+ alias on_clicked add_action_listener
93
+
94
+ # ========================================================================= #
95
+ # === on_event
96
+ # ========================================================================= #
97
+ alias on_event add_action_listener
98
+
99
+ # ========================================================================= #
100
+ # === set_font
101
+ # ========================================================================= #
102
+ def set_font(i = :hack_25)
103
+ original_set_font(
104
+ SwingParadise.jruby_font(i)
105
+ )
106
+ end
107
+
108
+ # ========================================================================= #
109
+ # === generic_border
110
+ #
111
+ # First argument must be the colour.
112
+ # ========================================================================= #
113
+ def generic_border(
114
+ use_this_colour = Color::Blue,
115
+ use_this_width = 2
116
+ )
117
+ setBorder(
118
+ BorderFactory.createLineBorder(use_this_colour, use_this_width)
119
+ )
120
+ end
121
+
122
+ # ========================================================================= #
123
+ # === blue_border
124
+ # ========================================================================= #
125
+ def blue_border(i = 2)
126
+ generic_border(Color::BLUE, i)
127
+ end
128
+
129
+ # ========================================================================= #
130
+ # === dimensions
131
+ #
132
+ # This is just a wrapper over setBounds() to allow us to work with
133
+ # a Hash instead.
134
+ # ========================================================================= #
135
+ def dimensions(
136
+ hash = {
137
+ x_axis: 10,
138
+ y_axis: 20,
139
+ width: 300,
140
+ height: 50
141
+ }
142
+ )
143
+ # is: x-coordinate, y-coordinate, width, height)
144
+ setBounds(
145
+ hash[:x_axis],
146
+ hash[:y_axis],
147
+ hash[:width],
148
+ hash[:height]
149
+ )
150
+ end
151
+
152
+ # ========================================================================= #
153
+ # The methods past this line are all stubs. They are not "real" methods
154
+ # yet, but added to remain compatible with the gtk_paradise gem.
155
+ # ========================================================================= #
156
+
157
+ # ========================================================================= #
158
+ # === clear_background
159
+ # ========================================================================= #
160
+ def clear_background
161
+ end
162
+
163
+ # ========================================================================= #
164
+ # === skyblue
165
+ # ========================================================================= #
166
+ def skyblue
167
+ end
168
+
169
+ # ========================================================================= #
170
+ # === bblack2
171
+ # ========================================================================= #
172
+ def bblack2
173
+ end; alias bblack1 bblack2 # should be changed at a later time.
174
+
175
+ # ========================================================================= #
176
+ # === bold_button
177
+ # ========================================================================= #
178
+ # def bold_button(i = '')
179
+ # end
180
+
181
+ # ========================================================================= #
182
+ # === do_use_mnemonic
183
+ # ========================================================================= #
184
+ def do_use_mnemonic
185
+ end
186
+
187
+ # ========================================================================= #
188
+ # === disallow_resizing
189
+ # ========================================================================= #
190
+ def disallow_resizing
191
+ end
192
+
193
+ # ========================================================================= #
194
+ # === hover
195
+ # ========================================================================= #
196
+ def hover(i = :lightblue)
197
+ end
198
+
199
+ end
@@ -0,0 +1,28 @@
1
+ # =========================================================================== #
2
+ # require 'swing_paradise/java_classes/jcheckbox/jcheckbox.rb'
3
+ # =========================================================================== #
4
+ java_import java.awt.Font
5
+
6
+ class Java::JavaxSwing::JCheckBox
7
+
8
+ # ========================================================================= #
9
+ # === is_selected?
10
+ # ========================================================================= #
11
+ alias is_selected? isSelected
12
+
13
+ # ========================================================================= #
14
+ # === is_active
15
+ # ========================================================================= #
16
+ def is_active
17
+ setSelected(true)
18
+ end
19
+
20
+ # ========================================================================= #
21
+ # === hint=
22
+ #
23
+ # This is currently not in use.
24
+ # ========================================================================= #
25
+ def hint=(i = '')
26
+ end
27
+
28
+ end
@@ -0,0 +1,31 @@
1
+ # =========================================================================== #
2
+ # require 'swing_paradise/java_classes/jcombobox/jcombobox.rb'
3
+ # =========================================================================== #
4
+ class Java::JavaxSwing::JComboBox
5
+
6
+ alias text? getSelectedItem # === text?
7
+
8
+ # ========================================================================= #
9
+ # === dimensions
10
+ #
11
+ # This is just a wrapper over setBounds() to allow us to work with
12
+ # a Hash instead.
13
+ # ========================================================================= #
14
+ def dimensions(
15
+ hash = {
16
+ x_axis: 10,
17
+ y_axis: 20,
18
+ width: 300,
19
+ height: 50
20
+ }
21
+ )
22
+ # is: x-coordinate, y-coordinate, width, height)
23
+ setBounds(
24
+ hash[:x_axis],
25
+ hash[:y_axis],
26
+ hash[:width],
27
+ hash[:height]
28
+ )
29
+ end
30
+
31
+ end
@@ -0,0 +1,253 @@
1
+ # =========================================================================== #
2
+ # require 'swing_paradise/java_classes/jcomponent/jcomponent.rb'
3
+ # =========================================================================== #
4
+ class Java::JavaxSwing::JComponent
5
+
6
+ # ========================================================================= #
7
+ # === tooltip=
8
+ # ========================================================================= #
9
+ alias tooltip= setToolTipText
10
+
11
+ # ========================================================================= #
12
+ # === set_global_font
13
+ # ========================================================================= #
14
+ def set_global_font(
15
+ font1 = Font.new('Hack', Font::PLAIN, 50)
16
+ )
17
+ UIManager.put('Button.font', font1)
18
+ UIManager.put('ToggleButton.font', font1)
19
+ UIManager.put('RadioButton.font', font1)
20
+ UIManager.put('CheckBox.font', font1)
21
+ UIManager.put('ColorChooser.font', font1)
22
+ UIManager.put('ComboBox.font', font1)
23
+ UIManager.put('Label.font', font1)
24
+ UIManager.put('List.font', font1)
25
+ UIManager.put('MenuBar.font', font1)
26
+ UIManager.put('MenuItem.font', font1)
27
+ UIManager.put('RadioButtonMenuItem.font', font1)
28
+ UIManager.put('CheckBoxMenuItem.font', font1)
29
+ UIManager.put('Menu.font', font1)
30
+ UIManager.put('PopupMenu.font', font1)
31
+ UIManager.put('OptionPane.font', font1)
32
+ UIManager.put('Panel.font', font1)
33
+ UIManager.put('ProgressBar.font', font1)
34
+ UIManager.put('ScrollPane.font', font1)
35
+ UIManager.put('Viewport.font', font1)
36
+ UIManager.put('TabbedPane.font', font1)
37
+ UIManager.put('Table.font', font1)
38
+ UIManager.put('TableHeader.font', font1)
39
+ UIManager.put('TextField.font', font1)
40
+ UIManager.put('PasswordField.font', font1)
41
+ UIManager.put('TextArea.font', font1)
42
+ UIManager.put('TextPane.font', font1)
43
+ UIManager.put('EditorPane.font', font1)
44
+ UIManager.put('TitledBorder.font', font1)
45
+ UIManager.put('ToolBar.font', font1)
46
+ UIManager.put('ToolTip.font', font1)
47
+ UIManager.put('Tree.font', font1)
48
+ end
49
+
50
+ def bblack1
51
+ end
52
+ def bblack2
53
+ end
54
+ def bblack3
55
+ end
56
+ def bblack4
57
+ end
58
+ def bblack5
59
+ end
60
+
61
+ # ========================================================================= #
62
+ # === mouse_listener
63
+ # ========================================================================= #
64
+ alias mouse_listener addMouseListener
65
+
66
+ # ========================================================================= #
67
+ # === min_size
68
+ # ========================================================================= #
69
+ def min_size(
70
+ width = 400,
71
+ height = 380
72
+ )
73
+ setMinimumSize(Dimension.new(width, height))
74
+ end
75
+
76
+ # ========================================================================= #
77
+ # === padding
78
+ # ========================================================================= #
79
+ def padding(i = 8)
80
+ setBorder(
81
+ EmptyBorder.new(i, i, i, i) # top,left,bottom,right
82
+ )
83
+ end; alias set_padding padding # === set_padding
84
+
85
+ # ========================================================================= #
86
+ # === pad1px
87
+ # ========================================================================= #
88
+ def pad1px
89
+ padding(1)
90
+ end
91
+
92
+ # ========================================================================= #
93
+ # === pad2px
94
+ # ========================================================================= #
95
+ def pad2px
96
+ padding(2)
97
+ end
98
+
99
+ # ========================================================================= #
100
+ # === pad3px
101
+ # ========================================================================= #
102
+ def pad3px
103
+ padding(3)
104
+ end
105
+
106
+ # ========================================================================= #
107
+ # === pad4px
108
+ # ========================================================================= #
109
+ def pad4px
110
+ padding(4)
111
+ end
112
+
113
+ # ========================================================================= #
114
+ # === pad5px
115
+ # ========================================================================= #
116
+ def pad5px
117
+ padding(5)
118
+ end
119
+
120
+ # ========================================================================= #
121
+ # === pad6px
122
+ # ========================================================================= #
123
+ def pad6px
124
+ padding(6)
125
+ end
126
+
127
+ # ========================================================================= #
128
+ # === pad7px
129
+ # ========================================================================= #
130
+ def padpx
131
+ padding(7)
132
+ end
133
+
134
+ # ========================================================================= #
135
+ # === pad8px
136
+ # ========================================================================= #
137
+ def pad8px
138
+ padding(8)
139
+ end
140
+
141
+ # ========================================================================= #
142
+ # === pad9px
143
+ # ========================================================================= #
144
+ def pad9px
145
+ padding(9)
146
+ end
147
+
148
+ # ========================================================================= #
149
+ # === pad10px
150
+ # ========================================================================= #
151
+ def pad10px
152
+ padding(10)
153
+ end
154
+
155
+ # ========================================================================= #
156
+ # === complex_font
157
+ #
158
+ # This is a convenience wrapper over .set_font().
159
+ #
160
+ # You only have to pass the first argument really; the other three
161
+ # arguments are not so important, as the first argument may override
162
+ # them automatically.
163
+ # ========================================================================= #
164
+ def complex_font(
165
+ i = 'Calibri 34',
166
+ use_this_font_name = 'Times',
167
+ use_this_font_size = 20,
168
+ use_this_font_type = Font::PLAIN
169
+ )
170
+ if i.is_a? Symbol
171
+ if i.to_s.include? '_'
172
+ splitted = i.to_s.split('_')
173
+ use_this_font_size = splitted.last.to_i
174
+ use_this_font_name = splitted.first.to_s
175
+ use_this_font_name[0,1] = use_this_font_name[0,1].upcase
176
+ i = use_this_font_name
177
+ first = use_this_font_name
178
+ end
179
+ end
180
+ if i and i.include?(' ')
181
+ splitted = i.split(' ')
182
+ first = splitted.first
183
+ last = splitted.last
184
+ if last =~ /^\d+$/ # If "only numbers".
185
+ use_this_font_size = last.to_i
186
+ end
187
+ if first
188
+ use_this_font_name = first
189
+ end
190
+ end
191
+ set_font(
192
+ Font.new(
193
+ first,
194
+ use_this_font_type,
195
+ use_this_font_size
196
+ )
197
+ )
198
+ end; alias use_this_font= complex_font # === use_this_font=
199
+
200
+ # ========================================================================= #
201
+ # === font_size
202
+ # ========================================================================= #
203
+ def font_size(
204
+ new_size = 25
205
+ )
206
+ new_size = new_size.to_f
207
+ setFont(
208
+ getFont.deriveFont(new_size)
209
+ )
210
+ end; alias font_size= font_size # === font_size=
211
+
212
+ # ========================================================================= #
213
+ # === default_close
214
+ # ========================================================================= #
215
+ def default_close
216
+ setDefaultCloseOperation(JFrame::EXIT_ON_CLOSE)
217
+ end
218
+
219
+ # ========================================================================= #
220
+ # === set_size_request
221
+ # ========================================================================= #
222
+ def set_size_request(
223
+ a = 400, b = 400
224
+ )
225
+ setSize(a, b)
226
+ end
227
+
228
+ # ========================================================================= #
229
+ # === width_height
230
+ # ========================================================================= #
231
+ def width_height(
232
+ width = 550,
233
+ height = 450
234
+ )
235
+ setPreferredSize(Dimension.new(width, height))
236
+ end; alias preferred_width_height width_height # === preferred_width_height
237
+
238
+ # ========================================================================= #
239
+ # === css_class
240
+ # ========================================================================= #
241
+ def css_class(i = '')
242
+ end
243
+
244
+ # ========================================================================= #
245
+ # === yellow_background
246
+ # ========================================================================= #
247
+ def yellow_background
248
+ set_background_colour(
249
+ java.awt.Color.new(98, 98, 72)
250
+ )
251
+ end
252
+
253
+ end
@@ -0,0 +1,23 @@
1
+ # =========================================================================== #
2
+ # require 'swing_paradise/java_classes/jeditorpane/jeditorpane.rb'
3
+ # =========================================================================== #
4
+ class Java::JavaxSwing::JEditorPane
5
+
6
+ # ========================================================================= #
7
+ # === may_be_edited
8
+ # ========================================================================= #
9
+ def may_be_edited
10
+ setEditable(true)
11
+ end
12
+
13
+ # ========================================================================= #
14
+ # === may_not_be_edited
15
+ #
16
+ # Disallow any change to the jeditorpane at hand.
17
+ # ========================================================================= #
18
+ def may_not_be_edited
19
+ setEditable(false)
20
+ end; alias read_only may_not_be_edited # === read_only
21
+ alias readonly may_not_be_edited # === readonly
22
+
23
+ end
@@ -0,0 +1,22 @@
1
+ # =========================================================================== #
2
+ # require 'swing_paradise/java_classes/jfilechooser/jfilechooser.rb'
3
+ # =========================================================================== #
4
+ # javax.swing.JFileChooser
5
+ # =========================================================================== #
6
+ class Java::JavaxSwing::JFileChooser
7
+
8
+ # ========================================================================= #
9
+ # === directories_only
10
+ # ========================================================================= #
11
+ def directories_only
12
+ setFileSelectionMode(JFileChooser::DIRECTORIES_ONLY)
13
+ end
14
+
15
+ # ========================================================================= #
16
+ # === open_the_dialog
17
+ # ========================================================================= #
18
+ def open_the_dialog
19
+ showOpenDialog(nil)
20
+ end
21
+
22
+ end