Hey, coders.

Check out the FileDrop library for doing file drag-and-drop:

http://iharder.sourceforge.net/filedrop/

The code is unlicensed and can be repackaged and used anywhere

It's almost trivial to use - with one class FileDrop you can respond to 
file drop events on any Swing component.  It took me literally 5 minutes 
to implement file dropping in the JTS TestBuilder, using this code:

  private void initFileDrop(Component comp) {
    new FileDrop(comp, new FileDrop.Listener() {
      public void filesDropped(java.io.File[] files) {
        try {
          openXmlFilesAndDirectories(files);
        } catch (Exception ex) {
          reportException(null, ex);
        }
      }
    });
  }

With this, I can see adding file dropping in two places in OJ:
- dropping onto a Task (Project) window would load the dataset(s) into 
that Task
- dropping onto the top OJ frame would create a new task and load the 
dataset(s) into it

This is a perfect example of where modularizing into View and Model is 
important.  The file loading/task creation code should be in the model 
module, where it can be called from many different view gestures (menu 
items and drop events, in this case).

Anyone keen to give this a go?

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to