Window Focus and TextArea text append
I have a logging window in my application. The messages are written to the JTextA开发者_StackOverflow社区rea inside this window.
JFrame -> JScrollPane -> JTextArea
Code that writes the messages:
LogTextArea.append(message + "\n");
If I have this log window open, whenever something writes a message to this window, the window automatically gets pushed to the top and focused.
For example, I have a form window open and Im filling out information. A message is written to the log window. When the message is written, the Log window gets focused and I can't type in the form I was filling out anymore.
How can I stop this from happening?
Here's an example using append()
that does not exhibit this behavior. You might compare it with your own code for differences.
精彩评论