Java拖放文件到Swing窗口计算机等级考试
文章作者 100test 发表时间 2010:01:26 09:47:03
来源 100Test.Com百考试题网
经过测试是没有问题的。
代码:
package com.test.ui.
import java.awt.datatransfer.DataFlavor.
import java.awt.datatransfer.UnsupportedFlavorException.
import java.awt.dnd.DnDConstants.
import java.awt.dnd.DropTarget.
import java.awt.dnd.DropTargetDragEvent.
import java.awt.dnd.DropTargetDropEvent.
import java.awt.dnd.DropTargetEvent.
import java.awt.dnd.DropTargetListener.
import java.io.File.
import java.io.IOException.
import java.util.Iterator.
import java.util.List.
import javax.swing.JTextArea.
public class DragFile extends javax.swing.JFrame {
public DragFile() {
initComponents().
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/