ruby - JRuby Closing an AWT frame -


i decided check out jruby , jogl see if graphics sim stuff running. i've got classpath set , opengl things included properly. following tutorials, suggest using awt frame instead of swing one, swing won't support graphics acceleration (which i'm looking for).

i can't figure out how close awt frame ruby, however. have windowadapter fires kernel.exit event when close button on frame clicked. looks this:

class controller < windowadapter   def windowclosing(event)     kernel.exit   end end 

the frame adds add_window_listener(controller.new). event fires when click close button, spits out following error:

exception in thread "awt-eventqueue-0" org.jruby.exceptions.raiseexception: (systemexit) exit

calling kernel.exit frame's initialize exits program. i'm not sure why calling listener fails. know in java can define anonymous windowadapter inline, have no idea syntax in ruby.

i did searching , experimentation , found answer. appears quirk of ruby implementation in jvm. calling exit or kernel.exit inside windowadapter useless.

calling java.lang.system.exit(0), however, does work. i'm not sure why distinction should make difference. expect exit alias java system command, apparently doesn't hope helpful else might run same problem.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -