lib/swing_helpers.rb in sensible-cinema-0.23.0 vs lib/swing_helpers.rb in sensible-cinema-0.23.1

- old
+ new

@@ -46,23 +46,35 @@ end end self end - def simulate_click - @block.call - end + def simulate_click + @block.call + end + def tool_tip= text + if text + text = "<html>" + text + "</html>" + text = text.gsub("\n", "<br/>") + end + self.set_tool_tip_text text + end + end + ToolTipManager.sharedInstance().setDismissDelay(java.lang.Integer::MAX_VALUE) # don't timeout tooltips... + class JFrame def close dispose # sigh end end class JFileChooser + # also set_current_directory et al... + # raises on failure... def go success = show_open_dialog nil unless success == Java::javax::swing::JFileChooser::APPROVE_OPTION java.lang.System.exit 1 # kills background proc...but we shouldn't let them do stuff while a background proc is running, anyway @@ -77,12 +89,14 @@ def set_file f set_selected_file JFile.new(f) end alias setFile set_file + end + # awt... class FileDialog def go show File.expand_path(get_directory + '/' + get_file) if get_file end @@ -121,8 +135,5 @@ else self end end end - -# code examples -# JOptionPane.showInputDialog(nil, "not implemented yet", "not implemented yet", JOptionPane::ERROR_MESSAGE) \ No newline at end of file