JavaFX 8 Tutorial 47 - Get Selected Filepath Into TextArea





The code written in this tutorial is:



private TextArea textArea;



browse.setOnAction(e ->{

//Single File Selection

            file = fileChooser.showOpenDialog(primaryStage);

            if(file != null){

                textArea.setText(file.getAbsolutePath());

             

            }



//Multiple File Selection

            /*List<File> fileList = fileChooser.showOpenMultipleDialog(primaryStage);

            if(fileList != null){

                fileList.stream().forEach(selectedFiles ->{

                    textArea.setText(fileList.toString());

                });

            }*/



}



fields.getChildren().addAll(searchField, label1, id, fn, ln, em, mobile, un, pw, date, male, female, checkBox1, checkBox2, checkBox3, browse, textArea, button);





       

Comments

Popular posts from this blog

JavaFX 8 Tutorial 62 - Jasper Report

JavaFX 8 Tutorial 64 Spring Boot CRUD with FXML