Class: Java::JavaxSwing::JFrame
- Inherits:
-
Object
- Object
- Java::JavaxSwing::JFrame
- Defined in:
- lib/swing_paradise/java_classes/jframe/jframe.rb
Overview
#
require ‘swing_paradise/java_classes/jframe/jframe.rb’
#
Instance Method Summary collapse
-
#exit_on_close ⇒ Object
# === exit_on_close ========================================================================= #.
-
#is_decorated ⇒ Object
# === is_decorated ========================================================================= #.
-
#is_not_resizable ⇒ Object
# === is_not_resizable ========================================================================= #.
-
#is_resizable ⇒ Object
# === is_resizable ========================================================================= #.
-
#set_width(i) ⇒ Object
# === set_width ========================================================================= #.
-
#show_all ⇒ Object
# === show_all ========================================================================= #.
-
#top_left ⇒ Object
# === top_left ========================================================================= #.
-
#width_height(width = 1024, height = 800) ⇒ Object
# === width_height ========================================================================= #.
-
#width_height=(width, height = nil) ⇒ Object
# === width_height= ========================================================================= #.
Instance Method Details
#exit_on_close ⇒ Object
#
exit_on_close
#
85 86 87 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 85 def exit_on_close setDefaultCloseOperation(JFrame::EXIT_ON_CLOSE) end |
#is_decorated ⇒ Object
#
is_decorated
#
92 93 94 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 92 def is_decorated setDefaultLookAndFeelDecorated(true) end |
#is_not_resizable ⇒ Object
#
is_not_resizable
#
36 37 38 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 36 def is_not_resizable JFrame.setResizable(false) end |
#is_resizable ⇒ Object
#
is_resizable
#
29 30 31 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 29 def is_resizable JFrame.setResizable(true) end |
#set_width(i) ⇒ Object
#
set_width
#
43 44 45 46 47 48 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 43 def set_width(i) i = i.to_i setPreferredSize( java.awt.Dimension.new(i, -1) ) end |
#show_all ⇒ Object
#
show_all
#
53 54 55 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 53 def show_all setVisible(true) end |
#top_left ⇒ Object
#
top_left
#
11 12 13 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 11 def top_left setLocation(0, 0) end |
#width_height(width = 1024, height = 800) ⇒ Object
#
width_height
#
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 60 def width_height( width = 1024, height = 800 ) 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 |
#width_height=(width, height = nil) ⇒ Object
#
width_height=
#
18 19 20 21 22 23 24 |
# File 'lib/swing_paradise/java_classes/jframe/jframe.rb', line 18 def width_height=(width, height = nil) if width.is_a? Array height = width.last width = width.first end setSize(width, height) end |