I am wondering how should we use java.awtFileDialog, considering the following example (copy and paste to https://javafiddle.leaningtech.com/ to test):
import java.awt.FileDialog;
import java.awt.Frame;
import java.awt.Button;
import java.awt.FileDialog;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class JavaFiddle extends Frame {
FileDialog fc;
JavaFiddle() {
super("MainClass");
setSize(200, 100);
fc = new FileDialog(this, "Choose a file", FileDialog.LOAD);
Button b;
add(b = new Button("Browse...")); // Create and add a Button
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fc.setVisible(true);
String fn = fc.getFile();
if (fn == null)
System.out.println("You cancelled the choice");
else
System.out.println("You chose " + fn);
}
});
}
public static void main(String[] args) {
new JavaFiddle().setVisible(true);
}
}
We can get the following interface:

However, I am not sure how to proceed further since when I select a file, the only option I have is to close the file dialog. What's the correct way to use it?
Ideally, I would like be able to render a hidden dialog with an <input type="file"> element, when setVisible(true) is called, trigger the file dialog by fileInput.click() method. After selection, the file should mounted e.g. under /str (even better if this can be addressed with #98 ).
I am wondering how should we use java.awtFileDialog, considering the following example (copy and paste to https://javafiddle.leaningtech.com/ to test):
We can get the following interface:

However, I am not sure how to proceed further since when I select a file, the only option I have is to close the file dialog. What's the correct way to use it?
Ideally, I would like be able to render a hidden dialog with an
<input type="file">element, whensetVisible(true)is called, trigger the file dialog by fileInput.click() method. After selection, the file should mounted e.g. under/str(even better if this can be addressed with #98 ).