hello,
the following code is an extract of my code
The jframe is set-up so that it contains a jtextarea and a jbutton (open file).Code:public FileChooserDemo() { fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); openButton = new JButton("Open a File..."); openButton.addActionListener(this); } public void actionPerformed(ActionEvent e) { if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(FileChooserDemo.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); }
How can i get the path of the file(picture - ill expand the code so that it will only select pictures) selected by the user and place the path onto the textarea?
Thanks for any help and/or suggestions,





Reply With Quote