JfileChooser multiple file selection

hi everyone....
i have an aplication with a Jfile chooser coded like this:
var chooser = new JFileChooser();
chooser.addChoosableFileFilter(
  FileFilter {
    override function getDescription() {
      "Video {extensions.toString()}"
    override function accept(file) {
      if (file.isDirectory())
        return true;
      def name = file.getName().toLowerCase();
      for (extension in extensions)
        if (name.endsWith(extension))
          return true;
      return false
chooser.setAcceptAllFileFilterUsed(false);and a image that calls the file chooser like this:
ImageView {//load button
            var image = 0;
            image : bind boton1[image]
            transforms : bind [Transform.translate(0,770),
                               Transform.scale(0.7,0.6),]
            onMouseClicked: function( e ) {
            if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(null)) {
                source = chooser.getSelectedFile().toURI().toString(); }
                                          }but now i want set the file chooser for multiple file selections and save those urls in to an array...
i added: //chooser.setMultiSelectionEnabled(true); and tried to save in to an array: insert chooser.getSelectedFiles()toString(); into myarray
but it only delivers unexpected data that can be readed...
please helpme with this one....
Already Thanks...
Edited by: darwinbotlee on 27/02/2010 06:40 PM

Hi, change the insert statement:
  var a = for(f in chooser.getSelectedFiles()) {
        f.getName();
insert a  into myarray ;   

Similar Messages

  • JFileChooser Multi file selection problem

    I am using jdk 1.4.2 .
    I tried enabling multiple file selection using JFileChooser but am not able to do so..
    following is the code extract..
    JFileChooser chooser = new JFileChooser();
    int returnVal = chooser.showOpenDialog(RTLogger.this);
    if(returnVal == CougarFileChooser.APPROVE_OPTION)
    chooser.setMultiSelectionEnabled(true);
    if(chooser.isMultiSelectionEnabled())
         System.out.println("multi enabled");//message is displayed
    File [ ] files = chooser.getSelectedFiles();
    System.out.println("the file length is " + files .length);
    //length is zero and not able to select multiple files
    }

    You have to set the option to allow multiple selections before you call showOpenDialog.

  • The file size of selected file in input file control is shown as 0 for multiple file selection in Safari 5.1

    The file size of selected file in input file control is shown as 0 for multiple file selection in Safari 5.1. If you select single file, then it is able to return file size correctly. However, if you select multiple files, then the file size of each of the selected file is always returned as 0 from javascript. This works correctly in Safari 4.0 but it does not work in Safari 5.1.
    How do I get the correct file size in Safari 5.1 ?

    If you want to post (or send me) a link to the lrcat file, I'd take a look at it for you, and give you a break-down what's consuming all the bytes. But it might be fun to learn how to do that yourself (e.g. using SQL). I use SQLiteSpy, but other people have their favorites.. (or you can use a command-line client if you prefer..). One way: just run "drop table "{table-name}" on each table then look at filesize (do this to a copy, not the real thing).
    Anyway, it's hard to imagine keywords and captions etc. taking much of the space, since even if you had 1000 10-character words of text metadata per photo average that still only adds up to 117MB, which isn't a substantial portion of that 8G you're seeing occupied.
    Anyway, if you've painted the heck out of most of them and not cleared dev history, that'll do it - that's where I'd put my money too...
    One thing to consider to keep file-size down:
    ===================================
    * After reaching a milestone in your editing, take a snapshot then clear edit history, or the top part of it anyway (e.g. leave the import step), using a preset like:
    Clear Edit History.lrtemplate
    s = {
        id = "E36E8CB3-B52B-41AC-8FA9-1989FAFD5223",
        internalName = "No Edit",
        title = "Clear Edit History",
        type = "Develop",
        value = {
            settings = {
                NoEdit = true,
            uuid = "34402820-B470-4D5B-9369-0502F2176B7F",
        version = 0,
    (that's my most frequently used preset, by far ;-})
    PS - I've written a plugin called DevHistoryEditor, which can auto-consolidate steps and reduce catalog size - it's a bit cumbersome to use a.t.m. but in case you're interested...
    Rob

  • How can I allow multiple file selections ?

    I used FileReference's browse function,
    But it's only can select one file at the same time.
    How can I allow multiple file selections ?
    Thanks a lot.

    You need a FileReferenceList object instead. See the Help for
    FileReferenceList, it has good examples.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • FileDialog with multiple files select

    Hi,
    I'm new to java programming.
    I would like to write a script that brings a filddialog window with ability select multiple files.
    I tried awt FileDialog, I could able to select only a single file.
    Any code sample would be much appreciated.
    Thanks.

    I am not sure it is possible in AWT FileDialog.
    But If you use Swing's JFileChooser, It is certainly possible.

  • Anyone know how to measure multiple file selections in a finder window?

    Hello,
    I have a flash drive that holds 8gbs. I have an enormous folder of images I am going to start passing to my buddy on the flash drive. Anybody know how I can select multiple files and know how big the selection will be prior to dragging them to the 8gb drive?
    Thank!
    Kirk

    Shift-click or command-click to select them, and then press the Option, Command, and I keys; the information in the window will change as the selection changes.
    (52489)

  • Dragging multiple file selections

    After I have highlighted a group of files to be moved and then attempt to drag them another location, the highlighted selection goes back to just the single file on which I have clicked. In other words, I cannot drag multiple files with the mouse. Is this a bug in Leopard, or have the rules changed?

    One trick that seems to work best for me is when I am trying to drag any number of files is to grab it by the icon and then drag. If I catch it anywhere else I have trouble getting repeatable drag and drops with multiple files.

  • Does awt FileDialog allows multiple file selection?

    i m trying to select multiple files using FileDialog, but it does not allow me? why? is it possible to select multiple files using FileDialog?

    Something you might want to try. Turn off the auto download. Put your card into the reader. Library Module, click on Import. Select Choose Files rather than the card drive itself. Now you have a navagatable window from which you may use to view thumbnails or names. Use the traditional CTRL + Click, or Shift + Click to select your files and click on Open. Your Import window appears for you to make your Import choices like normal.

  • Multiple Files selection

    Hello all,
    I want to know about “File Dialog.vi” in more details. Please help me.
    When I’m selecting 50 or 100 files then its working fine. But When I’m selecting more no.of files then it’s throwing Error message and also it’s taking more time.
    For your information I selected around 1500 files.
    BR,
    Munna
    Munna

    I'm using JDK 1.3.1_04, so you think that the behaviour describeb is a bug of the JFileChooser? So, do u know a way to correct that bug? Do u know any other classes that I could use instead of the JFileChooser?
    Thanks

  • How to tell if multiple files are selected when they are opened in windows

    Hello, can someone help me, my question is how to tell if multiple file selections were made when they were opened (right-click->open). Through modifying the registry I already have my Java program start up when a file with specific extension is double-clicked.
    The problem is when multiple files are opened at the same time, an instance of java program is created and run for each of the selected files. Ideally I would like it so that only one instance of java program is run, regardless of the number of selections.
    When you try it with Microsoft media player or winamp for example, it seems that only one process is created and run (I don't see many processes spawning when I watch it using task manager). Maybe this is more of Windows issue rather than Java programming issue. Any help is appreciated.

    If anybody wants to know, this can be solved by either 1) using DDE 2) using DropTarget (from Windows) 3) make a light-weight EXE dispatcher (eg. in C), and use file to have IPC between the dispatcher (which gets the filepath for each of the selections) and the java program. There can be other methods of course. Using the second option is the simplest but it requires WinXP and higher. I implemented it using option 3.. the downside of this is there's a warning message pop up when trying to open many (>20?) files at the same time by Windows. However, option 1 'seems' to have the same limitation. Having a java program created each time for each of the selections seems to be too slow, for viable option.

  • How do I use Finder to modify file details in multiple files

    I am new to the mac (OS10.7.4) having recently transitioned from Windows (and go way back to CPM - for those that remember).  I am trying to achieve through finder what I can do in windows explorer by selecting multiple files, selecting  properties and then selecting (and then modifying) details.  I tried the similar thing on Finder using Get Info instead of Properties but only ended up with multiple windows, one for each file selected (and had to close each one individually! ).  Tried 'option-command-I' on multiple selected files, it worked, but the common tags that I wanted to alter where not available for editing.  I can simply, but clumsily, achieve the outcome I want by cutting and pasting the files to a usb stick, making the modifications on the windows machine and pasting them back on the mac.     This should be a simple basic operating system function regardless of platform - advice on how to find/achieve it appreciated!

    I find it best to use small little apps to help modify many files. Just serach for what you want to change and more often then not, you find software that does what you need, often free too.
    For Music tags: check out the free program "TriTag" to do what you want:
    http://www.feedface.com/projects/tritag.html
    For Music conversion (say, from FLAC to Apple Lossless) or MP3 to whatever... Use "XLD" (free)
    http://download.cnet.com/X-Lossless-Decoder/3000-2140_4-189505.html
    Bonus: VLC (free download) - has the ability to convert wma audio files, which is amazing, it's rare to find mac software that will convert wma to mp3 - http://9thport.net/2010/07/28/using-os-x-to-convert-wma-to-mp3-for-free/
    For file renaming in batch, I use "Name Mangler" - 10 bucks, app store.
    It has a lot of pro features and is very useful.
    good luck.
    - James

  • Multiple file upload in jsp with out using �FILE� type filed.

    I have an applet that is used for multiple file selection, It allows drag and drop functionality also. The problem is once the user selects multiple files it has to get uploaded to the server. Since it�s not part of a file type component while submitting the form we won�t get the file contents.
    We can use multipart api for uploading files, but if the file selected by the user is not by the file type filed the file contents won�t come as part in the jsp submission and I can�t assign the file names selected by the user through the applet to any FILE (hidden ) type in jsp .
    Please give a solution�

    We can use multipart api for uploading files, but if the file selected by the user is not by the file type filed the file contents won’t come as part in the jsp submission and I can’t assign the file names selected by the user through the applet to any FILE (hidden ) type in jsp .Well i think thats a wrong notion which you have...
    you can very well get non-file type field data & file item data from a multipart form.
    Anyways,Letz checkout a simple example(refer to the below Code-snippet down below) which can do that task for us and it uses commons-fileupload & commons-io libraries.
    FileUpload.jsp
    ==========
    <form name="sampleForm" action="uploadAction" method="POST" enctype="multipart/form-data">
      File Name 1: <input type="text" name="fileName1" size="5" /> <br/>
      File: <input type="file" name="file1" id="file1" /> <br/>
      File Name 2: <input type="text" name="fileName2" size="5" /> <br/>
      File: <input type="file" name="file2" id="file2" /> <br/>
      File Name 3: <input type="text" name="fileName3" size="5" /> <br/>
      File: <input type="file" name="file3" id="file3"/> <br/>
      File Name 4: <input type="text" name="fileName4" size="5" /> <br/>
      File: <input type="file" name="file4" id="file4"/> <br/>
      <input type="submit" value="upload"/>
    </form>uploadAction method in (backingBean) :
    ==============================
    public void uploadAction(HttpServletRequest request,HttpServletResponse response)throws Exception{
          FileUploadUtils fuu = new FileUploadUtils(request);
          Map<String,FileItem> fileFields = fuu.getFileFiledsMap();
          Map<String,String> nonfileFields = fuu.getNonFileFiledsMap();
           String fileName1 =  nonfileFields.get("fileName1");
           FileItem file1 = fileFields.get("file1");       
           byte file1ContentBuffer[] = file1.get();
           String file1ContentType = file1.getContentType();
           InputStream file1ins = file1.getInputStream(); 
           file1.write(file1Name);
           String fileName2 =  nonfileFields.get("fileName2");
           FileItem file2 = fileFields.get("file2");
           byte file2ContentBuffer[] = file2.get();
           String file2ContentType = file2.getContentType();
           InputStream file2ins = file2.getInputStream();
           file2.write(file2Name);
    }FileUploadUtils.java:
    ===============
    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.Iterator;
    import java.util.List;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.commons.fileupload.DiskFileUpload;
    import org.apache.commons.fileupload.FileItem;
    import com.gehcsr.utils.dao.DbQueryUtils;
    public class FileUploadUtils {
       private Map<String,FileItem> fileItemMap = null;
       private  Map<String,String> nFileItemMap = null;
       private HttpServletRequest request = null;
       public FileUploadUtils(HttpServletRequest request)throws Exception{
                   this.request = request;    
                   this.fileItemMap = new HashMap<String,FileItem>();
                   this.nFileItemMap = new HashMap<String,String>();
                   this.init();
       private void init() throws Exception{
          DiskFileUpload dfu  = null;
          List fileItems  = null;   
             try{
                   dfu = new DiskFileUpload();
                   dfu.setSizeMax(1000000);
                   dfu.setSizeThreshold(4096);
                   dfu.setRepositoryPath(System.getProperty(java.io.tmpdir));
                   fileItems = dfu.parseRequest(this.request);
                   if(dfu.isMultipartContent && fileItems != null){
                            Iterator iter =  fileItems.iterator();
                  while (iter.hasNext()) {
                       FileItem item = (FileItem) iter.next();           
                                  String fieldName = item.getFieldName(); 
                             if (!item.isFormField()){
                                              String fieldValue = item.toString();
                                               this.nFileItemMap.put(fieldName,fieldName); 
                                         }else
                                             this.fileItemMap.put(fieldName,item);                              
                    }catch(Exception exp){
                         exp.printStackTrace();
                         System.err.println(exp.getMessage());
                         throw new Exception(exp.getCause());
                    } finally{
                       fileItems = null;
                       dfu = null; 
             public  Map<String,FileItem>  getFileFiledsMap(){
                    return this.getFileFiledsMap;
             public Map<String,String> getNonFileFiledsMap(){
                   return this.nFileItemMap;
    NOTE:* Do not forget to add latest versions of commons-fileupload.jar & commons-io.jar in your classpath.You might get few warings due some issues with regards to generics please neglect them.
    and it is not certain that you ought to use commons libraries for this there are many other alternative solutions available by which you can implement a similar functionality.
    Hope this might help !!! if that does do not forget to assign/share duke dollars which you have promised :)
    REGARDS,
    RaHuL

  • Need multiplt file select in LabVIEW 6.1

    I would like to select multiplt files at a time using shift key. I upgraded to LabVIEW 6.1 this feature is not available.

    We have an example program in our database that does this:
    Multiple File Selection Dialog Box
    You can either select file(s) (select multiple by holding down the shift key while selecting) and click on the Add button to add them to your selected files list, or you can double click any individual file to add it.
    Ray Kong
    Applications Engineer
    National Instruments

  • JFileChooser/Selecting multiple files

    All,
    I'm using the JFileChooser object in 1.4.1_02. Using the multiselection option, I'm allowed to select multiple files. However, when I scroll to the right in the JFileChooser dialog and select more files, the file chooser always returns to the beginning of the list. The files I selected to the right are chosen, but for me to select more files that are displayed to the right, then I need to rescroll back to the right. Is there a setting that I'm not doing? Has anyone else seen this problem?
    Thanks,
    Van Williams

    From the Mac Help selection in the Finder's Help menu:
    Selecting items</b?
    In the Finder and other applications, you can select items in several ways.
    1. Click to select a single item. Drag to select a group of items.
    2. Press the Shift key and click other items to include them in the selection. Click a selected item to deselect it.
    3. To select multiple items in a list that are not next to one another, press the Command key and click the items you want. Click a selected item again to deselect it.
    To "copy" items rather than "move" them you can select the items then press COMMAND-C. Open the Finder window on the desired destination location and then press COMMAND-V to paste.

  • JFileChooser Multiple selection not working on Mac using apple, command key

    I am using Java 1.4 webstart on Mac machine.
    The code is :
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(2);
    fileChooser.setMultiSelectionEnabled(true);
    Once the File dialog opens I have problems in selecting random multiple files. Apple key or command key is used for random selection on Mac. When using either of these keys multiple selection is not possible. Whereas I am able to select files using the shift key by which row selection is possible.
    If this is not a bug and some code changes are to be done it would be fine if somebody can help me out in this.
    If this is a bug in Java 1.4 and is this fixed in Java 1.5?

    All EIDE / ATA (Parallel) devices (drives, opticals) allowed for two such drives or devices on one bus. The old style was "master" and "Slave" but CS is a "smart" approach, however, the master or only device must be on the end position. Also, the end connector will be black, the middle (slave) is gray.
    Eject sends signal to master
    To eject the "slave" device you use a modifier key.

Maybe you are looking for

  • Whenever I try to open Microsoft Word it doesn't open and shows me an error report!

    Whenever I try to open Microsoft Word it doesn't open and shows me an error report! I don't know what to do! Help!!!! This is the extra info that comes along with the error report: Microsoft Error Reporting log version: 2.0 Error Signature: Exception

  • Fonts are replaced with Adobe Sans in PDF

    Receive PDF files from a client every month, 3 of the fonts in the file (Fortis Helvetica Bold, Fortis Helvetica Light Bold, and Fortis Helvetica Light) are not embedded. Fonts have been supplied and are installed in C:\WINDOWS\Fonts and C:\Program F

  • How to intercept variables in report's formula field via TOAD?

    I have a case in this report. I have a report that generates a list of items with info of their initial stock, stock movements and final stock. no problem for the in and out stock movements. but there's a slight problem with the initial stock. I wrot

  • The string version of a scanner.nextInt

    is it possible to use a scanner.nextInt for string's? I want to filter out a lettercode input : 23 54 64 34 23 VV If this is the input, than i want my program to know that there is a VV in it. Hopefully you understand what I mean.

  • Add JPanel to a JFrame

    I have two classes. One is the main frame, and the other class is a panel. The constructor of the main frame looks like this:           JFrame.setDefaultLookAndFeelDecorated(true);           JFrame frame = new JFrame("main");           frame.setDefau