Class: javaxjavax::swing::JFrame::CloseListener
- Inherits:
-
Object
- Object
- javaxjavax::swing::JFrame::CloseListener
- Defined in:
- lib/simple_gui_creator/jframe_helper_methods.rb
Overview
class StateListener
include java.awt.event.WindowListener
end
Instance Method Summary collapse
-
#initialize(parent, &block) ⇒ CloseListener
constructor
A new instance of CloseListener.
-
#windowClosed(event) ⇒ Object
sometimes this, sometimes the other…
- #windowClosing(event) ⇒ Object
Constructor Details
#initialize(parent, &block) ⇒ CloseListener
Returns a new instance of CloseListener.
16 17 18 19 20 |
# File 'lib/simple_gui_creator/jframe_helper_methods.rb', line 16 def initialize parent, &block super() @parent = parent @block = block end |
Instance Method Details
#windowClosed(event) ⇒ Object
sometimes this, sometimes the other…
22 23 24 25 26 27 28 |
# File 'lib/simple_gui_creator/jframe_helper_methods.rb', line 22 def windowClosed event # sometimes this, sometimes the other... if @block b = @block # force avoid calling it twice, since swing does seem to call this method twice, bizarrely @block = nil b.call end end |
#windowClosing(event) ⇒ Object
30 31 32 33 |
# File 'lib/simple_gui_creator/jframe_helper_methods.rb', line 30 def windowClosing event #p 'windowClosing' # hitting the X goes *only* here, and twice? ok this is messed up @parent.dispose end |