| Class | Limelight::FileChooser |
| In: |
lib/limelight/file_chooser.rb
|
| Parent: | Object |
An object that manages the selection of a file on the file system. When invoked, a file chooser window will pop up and allow the user to select a file.
| chooser | [R] | |
| chosen_file | [R] |
Creates a new FileChooser. Options may include:
# File lib/limelight/file_chooser.rb, line 23
23: def initialize(options = {}, &filter)
24: @options = options
25: @parent = options[:parent]
26: create_chooser
27: @chooser.setFileFilter(FileFilter.new(@options[:description], &filter)) if filter
28: end
Opens the windows and returns the chosen file.
# File lib/limelight/file_chooser.rb, line 32
32: def choose_file
33: returnVal = @chooser.showOpenDialog(@parent);
34:
35: if(returnVal == javax.swing.JFileChooser::APPROVE_OPTION)
36: @chosen_file = @chooser.getSelectedFile().absolute_path
37: else
38: @chosen_file = nil
39: end
40:
41: return @chosen_file
42: end