Saturday, 14 September 2013

Java Swing JFileChooser append files to a JTextArea

Java Swing JFileChooser append files to a JTextArea

I have a browse button which opens a dialog where the user can view
directories and files. I am having some trouble appending the files the
user selects to a JTextArea. I am trying to do this so the user can select
multiple files at a time. The files eventually will be submitted to an
Oracle database.
The code I have used for the filechooser is here:
final JFileChooser fc = new JFileChooser();
JList list = new JList();
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
if (JFileChooser.APPROVE_OPTION == fc.showOpenDialog(list)) {
File file = fc.getSelectedFile();
Can you please show me how to append the files to a JTextArea?
Thanks.

No comments:

Post a Comment