Results 1 to 3 of 3
  1. #1
    althair is offline Member
    Join Date
    Dec 2009
    Posts
    9
    Rep Power
    0

    Default JFileChooser - sequential files treatment

    Hi,

    I want to write an application where:

    1. In JFileChooser - select multiple files
    2. After clicking "Approve" button proper dialog window appears.
    3. In dialog I enter parameters for first selected file and click OK.
    4. File is processed in a background (it is transformed.
    4. Window from point 3 appears again and actions 3 and 4 are repeated for the second, the third, fourth etc time- for each file selected previously in 1.

    My application works fine for single file but I would like to implement"sequencing" files treatment. Can anybody help me to do it?

  2. #2
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    5

    Default

    The proposed user interface design would not be one I would like to use.
    It is like having to choose all the nouns before writing a short story.
    You should consider alternatives.
    One possibility would be to use JFileChooser's setAccessory() method
    to add buttons to the window. These buttons could be deisgned to
    choose among the operations that are applied to files.
    Then there would be only the one window with the file chooser;
    the second window to choose an operation would be unneeded.

    But let's suppose that you really want the design proposed.
    Here's how:
    First rearrange the main program so it is essentially:

    Java Code:
    final JFileChooser fc = new JFileChooser();
    int returnVal = fc.showOpenDialog(aComponent);
    chooseAndStartAnAction(fc.getSelectedFile());
    Now the new program is simply this:
    Java Code:
    final JFileChooser fc = new JFileChooser();
    fc.setMultiSelectionEnabled(true);
    int returnVal = fc.showOpenDialog(aComponent);
    File [] targets = fc.getSelectedFile[COLOR="Red"][B]s[/B][/COLOR](); 
    for (File f : targets)
             chooseAndStartAnAction(f);

  3. #3
    althair is offline Member
    Join Date
    Dec 2009
    Posts
    9
    Rep Power
    0

    Default

    Thanks a lot! It works great now. I have some issues with formatting float numbers in destination .csv file but I shall overcome them soon :).

Similar Threads

  1. Replies: 6
    Last Post: 09-04-2009, 02:48 AM
  2. Realize default value/sequential number in reporting tool
    By freezea in forum Reviews / Advertising
    Replies: 0
    Last Post: 04-21-2009, 07:08 AM
  3. Realize default value/sequential number in reporting tool
    By freezea in forum Reviews / Advertising
    Replies: 0
    Last Post: 04-13-2009, 04:25 PM
  4. Replies: 4
    Last Post: 12-03-2008, 11:07 PM
  5. Problem with Sequential File and Arrays
    By rhivka in forum New To Java
    Replies: 8
    Last Post: 07-30-2007, 09:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •