import javax.swing.*;\r
import java.awt.*;\r
import java.awt.event.*;\r
+import java.awt.dnd.*;\r
+import javax.swing.*;\r
+import java.awt.datatransfer.*;\r
+import java.io.*;\r
\r
\r
-public class Desktop extends jalview.jbgui.GDesktop\r
+public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListener\r
{\r
public static JDesktopPane desktop;\r
static int openFrameCount = 0;\r
jalview.bin.Cache.setProperty("SCREEN_HEIGHT", getHeight() + "");\r
}\r
});\r
- setVisible(true);\r
+setVisible(true);\r
\r
-/////////Add a splashscreen on startup\r
+this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));\r
\r
\r
/////////Add a splashscreen on startup\r
windowMenu.add(menuItem);\r
}\r
\r
+ public void dragEnter(DropTargetDragEvent evt){}\r
+ public void dragExit(DropTargetEvent evt){}\r
+ public void dragOver(DropTargetDragEvent evt){}\r
+ public void dropActionChanged(DropTargetDragEvent evt){}\r
+ public void drop(DropTargetDropEvent evt)\r
+{\r
+ Transferable t = evt.getTransferable();\r
+ if(!t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))\r
+ return;\r
\r
+ evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);\r
+ try{\r
+ java.util.List files = (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor);\r
+\r
+ for (int i = 0; i < files.size(); i++)\r
+ {\r
+ String file = files.get(i).toString();\r
+ String protocol = "File";\r
+ String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+ LoadFile(file, protocol, format);\r
+ }\r
+\r
+ }catch(Exception ex){ex.printStackTrace();}\r
+ }\r
\r
public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
{\r
if (FormatProperties.contains(format))\r
sequences = FormatAdapter.read(file, protocol, format);\r
\r
- if (sequences != null)\r
+ if (sequences != null && sequences.length>0)\r
{\r
AlignFrame af = new AlignFrame(new Alignment(sequences));\r
addInternalFrame(af, file, 700, 500);\r
\r
String format = IdentifyFile.Identify(url, "URL");\r
\r
- System.out.println(format +" format");\r
if (format.equals("URL NOT FOUND"))\r
{\r
JOptionPane.showInternalMessageDialog(Desktop.desktop,"Couldn't locate " + url,\r
"JalView 2005 version " + jalview.bin.Cache.VERSION+"; last updated: "+jalview.bin.Cache.BUILD_DATE\r
+"\nAuthors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton."\r
+"\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee."\r
- +"\nIf you use JalView, please cite: \"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"",\r
+ +"\nIf you use JalView, please cite: Bioinformatics, 2004 12;426-7."\r
+ +"\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"",\r
"About Jalview",\r
JOptionPane.INFORMATION_MESSAGE);\r
}\r