我试图在JButton中触发JDialog#dispose
class SettingsDialog < JDialog
include_package 'javax.swing'
include Profligacy
def initialize(frame, modal)
layout = "[ save ]"
@ui = Swing::LEL.new(JFrame, layout) do |c, i|
c.save = @save_button = JButton.new "Save"
i.save = { action: method(:save) }
end
end
def save(type, event)
self.dispose
end
end
输出为:nothing :(并且JDialog仍然打开
我做错了什么?