1
I understood that here I urge the class JFileChooser
:
JFileChooser arquivo = new JFileChooser();
I take the file object and call the class method JFileChooser
(correct me if I’m wrong):
arquivo.setDialogTitle("Selecionar Arquivo");
arquivo.setFileSelectionMode(JFileChooser.FILES_ONLY);
int retorno = arquivo.showOpenDialog(this);
In the next passage I did not understand. I call the method getSelectedFile();
class JFileChooser
and then play it within a class? I’ve never seen it happen in php.
What happened to arquivo.getSelectedFile();
? Where did I play this? File file is what?? num is an incomplete class? Or File is a file variable like File?
if(retorno == JFileChooser.APPROVE_OPTION) {
File file = arquivo.getSelectedFile();
jTextField5.setText(file.getPath());
}else {
}
The.getSelectedFile(); returns something new Numseioque(); that’s it??
– Edenilson Conceição
@Edenilsonconception no, this method, as I explained, returns a path from the file selected in Jfilechooser, and this path is File type, which is the java type to handle running operating system files.
– user28595