I'm building a chat application. I have a JFrame, which contains a JTextArea and below it a JTextField which is a chat window frame. Now i can type text in the JTextField and click send button to send the text to the JTextArea.
The chat request comes and gets added into a JTable from a custom server. By double clicking the row of a JTable, the chat window(JFrame) opens.
Similarly, when a second chat request comes and gets added into the JTable and on double clicking it, new chat window opens, but the existing chat window's contents get disappeared. What i mean is the JFrame (of the existing chat window) remains as it is, but whatever chat lines i typed and sent to the JTextArea gets disappeared. The JTextArea and the JTextField becomes untypable/uneditable.
One more problem is in teh second chat window, whatever chat i type in the JTextField and click "Send" button, the text disappears after clicking the Send button. If i press "Enter" key the text doesn't disappear and also it stays in the JTextField itself and doesb't pass to the JTextArea. The JTextArea is added on a JScrollPane. So that long chat texts can be viewed by scrolling down.
I couldn't post the code here as it is a part of a big application and it will be difficult for me to cut a part of the code and paste it here as it won't be helpful in resolving the issue.
Sounds like you've got quite a problem, but I'm going to venture to say that without code, it'll be hard for others to figure out just how to solve it. I'll venture again though, this time to guess that there may be a static issue here (perhaps?). Does any of your code use static fields? Could you be reusing the same components of one frame in another?
Thanks for the reply. Its very difficult to analyze this problem without the code as you said. But i can't post the code since the code is scattered in various packages and it won't be easy to understand. Basically, its a poorly designed application. But its too late to change the design.
A small correction. There is no JTextFields anywhere. Both are JTextArea. In a single chat window (JFrame) one JTextArea to display the chat text. Below that a JTextArea to type the chat text