-1

I have this label:

//---- 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"));

But I want to make something like this:

//---- 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)

How I can do this?

i try this...

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);
                }
            });
Malasuerte94
  • 1,454
  • 3
  • 14
  • 18
  • 4
    [What have you tried?](http://www.whathaveyoutried.com/) I mean *besides* asking random strangers on the internet to do it for you. Have you gone through the [D'n'D tutorial](http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html) & the [basic I/O](http://docs.oracle.com/javase/tutorial/essential/io/) tutorial? What is your actual, specific, question? Where are you stuck? Not your down voter (yet) but please show some effort. – Andrew Thompson Jun 10 '12 at 11:09

1 Answers1

1

Try to read this post, especially answer and implement method processFiles to filter input files and handle just images, if you found image just create ImageIcon as you want.

Community
  • 1
  • 1
Sergii Zagriichuk
  • 5,389
  • 5
  • 28
  • 45