Re: Show output on jTextArea
BTW i think the code as to be inside:
Code :
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {
//código para Output
}
this action performed is from "Listagem de ficheiros", the onde that makes the output
Re: Show output on jTextArea
File folder = new File("C:\\Users\\Hugo Monteiro\\Documents\\NetBeansProjects\\FileImporte r\\ImagensDB");
File[] listOfFiles = folder.listFiles();
for (int i=0; i<listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
jTextArea1.append("File: " +listOfFiles[i].getName().split("-"));
}
}
While it's allowable, somehow, probably it calls the array's toString, to use the split, which returns an array, you're going to have the word "File: " + a bunch of silly characters that is a String array toString. Probably not what you wanted.
Also, as far as I know, you can't just "open" a JTextArea itself. I think you need a JFrame or something similar to do that.
As for the JMenuItem, you could simply use the addActionListener() method.
split("001-A Retro Autumn-Garnett Rules-MAI2012-24.45-Landscapes.jpg") is returning a String array
String[] tempArray = split(.......);
tempArray[0] = "001";
tempArray[1] = "A Retro Autumn";
tempArray[2] = "Garnett Rules";
tempArray[3] = "MAI2012";
tempArray[4] = "24.45";
tempArray[5] = "Landscapes.jpg";
Re: Show output on jTextArea
You could instead just use the replaceAll() method. Using the split() method, as stated above, will return an array of strings.