Search code examples
javaswingjtextareaevent-dispatch-threadconcurrency

JTextArea default value?


I have been taught only to manage the GUI through the event dispatcher thread. Currently I am using a textArea.append("something"); outside of the event dispatcher thread, but I want this to always happen at the start of running the program. How can I set a listener to act upon the start up for the program or is what I have done acceptable?


Solution

  • Use the constructor JTextArea(String text) on creating it.