JTextArea: text not visible but existent after calling setText()

Hi everybody

I got a strange problem concerning JTextArea which should display messages in a Chat sent over RMI: the messages are added to the area but not visible after calling setText() (during debugging, the getText() method returns the added message). I first thought it was a problem with threads since the setText() method gets called out of the system thread on the receiving side. So I used SwingUtilities.invokeLater(new Runnable()...); to do the trick and the setText() was performed by the EventDispatch thread (seen in debug mode) but still the JTextArea remained visually empty.

Do you have any idea what the problem could be? The text is there, I can manually write in the area but after receiving messages the area is not updated.

thanx for your help!

[791 byte] By [zooBeea] at [2007-11-27 2:21:06]
# 1

Well, first of all you probably should be using the append(...) method to add new messages to the text area, not the setText(...) method.

You probably have two text areas defined. One as a class variable and one as a local variable. So you are updating the text of a text area that has not been added to the GUI.

camickra at 2007-7-12 2:23:17 > top of Java-index,Desktop,Core GUI APIs...