【发布时间】:2012-06-10 11:02:41
【问题描述】:
我有这个标签:
//---- label5 ----
label5.setText("Drag and drop your texture\npack in the box *.zip files");
label5.setIcon(new ImageIcon(
"E:\\Chituri\\MBMLauncherJava\\src\\resursele\\dasdasdasd.png"));
但我想做这样的事情:
//---- label5 ----
label5.setText("Drag and drop your texture\npack in the box *.zip files");
label5.setIcon(new ImageIcon(
"E:\\Chituri\\MBMLauncherJava\\src\\resursele\\dasdasdasd.png"));
// drag files in the label >
// automatically move files in particular folder (E:\\Chituri)
我该怎么做?
我试试这个...
label5.setTransferHandler(transfer);
label5.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent e){
JLabel texturidrag = (JLabel)e.getSource();
TransferHandler handle = texturidrag.getTransferHandler();
handle.exportAsDrag(texturidrag, e, TransferHandler.COPY);
}
});
【问题讨论】:
-
What have you tried? 我的意思是除了让互联网上的随机陌生人为你做这件事。你看过D'n'D tutorial 和basic I/O 教程吗?您的实际、具体问题是什么?你被困在哪里了?不是你的反对票(还),但请表现出一些努力。
标签: java file file-io drag-and-drop awt