-1

私はこのラベルを持っています:

//---- 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);
                }
            });
4

1 に答える 1

1

この投稿を読んでみてください。特に、processFiles入力ファイルをフィルタリングして画像だけを処理する方法を回答して実装しImageIconてください。

于 2012-06-10T11:28:42.077 に答える