PDA

View Full Version : Adding/displaying JTextArea to previously created JPanel


Dan06
03-05-2009, 05:52 PM
How can I add a JTextArea to an already created GUI and have it re-display?

I've tried using the code below, but it doesn't show the newly created JTextArea with the included Text; it doesn't show any error messages either.

NOTE: thumbnailPanel is held within containerPanel, and both are already/previously created and added to the JApplet's contentPane.


public void addText(LinkedList<String> fileNames){
for (String fileName : fileNames){
fileNameString = fileName + "\n";
}
thumbnailPanel.add(new JTextArea(fileNameString));
thumbnailPanel.repaint();
containerPanel.repaint();
}