• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in JFrame

 
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,

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.

I am using Java Version: 1.4.2_08

Kindly help me in resolving the problem.

Thank you very much,
Vijay
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Pete,

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

They are declared as static variables like this:

public static JTextArea txtranscript = new JTextArea(); \\ Display Chat Text in this JTextArea
public static JTextArea txMessagescript = new JTextArea(); \\ Type Chat text in this JTextArea

Please help.

Thanks,
Vijay
reply
    Bookmark Topic Watch Topic
  • New Topic