-2

I'm new to the smack API i created a chat programe with it, which seems to be very well successful, i used a JTabbed pane that adds a JSplitPane which also adds a textArea where client types in message and a JTextPane that inserts received message. but the problem is that each time a message is received it appends to both JTAbbedPane that holds a textPane. what i actually want is each JTabbedPane/JtextPAne should be independent to itself...each chat with a user should be seen on a particular tabb not all tabs.....

Maroun
  • 94,125
  • 30
  • 188
  • 241
Paul Okeke
  • 1,384
  • 1
  • 13
  • 19

1 Answers1

1

It sounds like you are adding the same content to each tab. Instead, create a different instance of your chat container for each tab, as shown here. Two approaches are common:

  • Extend JPanel and establish instance variables for any required objects.

  • Create a factory method, as shown here. Use getClientProperty() and putClientProperty() to store and retrieve any required objects.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • yes i'm adding the same content to each tab.... i'm actually adding the JsplitPane that holds content for the chat!!!,.... buh with a distinct user – Paul Okeke Mar 30 '13 at 12:47
  • You are welcome. Am I correct to infer that each user also need their on instance(s) of `Smack` library classes that communicate with the chat server? – trashgod Mar 30 '13 at 12:58
  • Yes!!! Thanks TrashGod.... Sorry I'm replying late... but it was successful. – Paul Okeke Sep 18 '14 at 09:37