Two possibilities:
- I don't understand the concept behind WebFileDrop
or
- WebFileDrop doesn't allow me to add files
I tried to use setSelectedFiles() to add files to it but that didn't work - i tried that because getSelectedFiles gives me all the files currently inside, to it seems plausible. But i don't know if i got it right because i can't see a reason to name the methods get/setSELECTEDfiles...
What i tried:
public class FileDropTest extends WebFrame {
ArrayList<File> files = new ArrayList<File>();
WebFileDrop fileDrop = new WebFileDrop();
public static void main(String[] args) {
WebLookAndFeel.install();
new FileDropTest().setVisible(true);
}
public FileDropTest() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new Dimension(400, 500));
files.add(new File("text.txt"));
fileDrop.setShowFileExtensions(true);
fileDrop.setSelectedFiles(files); // Doesn't work??
WebButton button = new WebButton("Show files");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileDrop.setSelectedFiles(files); // Doesn't work??
System.out.println(fileDrop.getSelectedFiles());
}
});
add(button, BorderLayout.NORTH);
add(fileDrop, BorderLayout.CENTER);
pack();
setLocationRelativeTo(null);
}
}
Another thing:
fileDrop.setShowFileExtensions(true);
doesn't work.
Two possibilities:
or
I tried to use setSelectedFiles() to add files to it but that didn't work - i tried that because getSelectedFiles gives me all the files currently inside, to it seems plausible. But i don't know if i got it right because i can't see a reason to name the methods get/setSELECTEDfiles...
What i tried:
Another thing:
doesn't work.