Class: Java::JavaxSwing::JFrame
- Inherits:
-
Object
- Object
- Java::JavaxSwing::JFrame
- Defined in:
- lib/swing_paradise/jframe/jframe.rb
Instance Method Summary collapse
-
#show_all ⇒ Object
# === show_all ========================================================================= #.
-
#width_height(width, height) ⇒ Object
# === width_height ========================================================================= #.
Instance Method Details
#show_all ⇒ Object
#
show_all
#
8 9 10 |
# File 'lib/swing_paradise/jframe/jframe.rb', line 8 def show_all setVisible(true) end |
#width_height(width, height) ⇒ Object
#
width_height
#
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/swing_paradise/jframe/jframe.rb', line 15 def width_height(width, height) if width.is_a? String # This can be like this: '62% or minimum 300px' if width.include? 'px' scanned = width.scan(/(\d{1,}px)/) width = scanned.flatten.first.delete('px') end end if height.is_a? String # This can be like this: '62% or minimum 300px' if height.include? 'px' height = height.scan(/\d{1,}px/).flatten.first.delete('px') end end width = width.to_i height = height.to_i setSize(width, height) # The next variant does not appear to work that well: # setPreferredSize(Dimension.new(width, height)) end |