0

Ive got a JTextArea to display the conversation, and i was wondering whats the best way to store the dynamic conversation, and was wondering if there's a better way (like appending) rather then rewritting the whole string to JTextArea after every mssg sent and recieved.

thanks ahead

kleopatra
  • 51,061
  • 28
  • 99
  • 211
Ofek Ron
  • 8,354
  • 13
  • 55
  • 103

2 Answers2

2

JTextAre has append(str) method to append string to it. For chat area it will be good to use JTextPane instead of JTextArea, cause it allows to draw coloring string and emotions images.

Harry Joy
  • 58,650
  • 30
  • 162
  • 207
0

I suggest storing it in a Text File. Storing all the text in database won't be a good idea.

You can for example store the chat in text file called for example 874658.txt then store the name of this file in the database, along with date of the chat and the parties of it.

mohdajami
  • 9,604
  • 3
  • 32
  • 53