• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting focus on the appended text in JTextArea

 
Raghav Mathur
Ranch Hand
Posts: 641
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
i have a chat room with a text area where any new message is appended to the textarea .

where str is a string which the user types in the text field and displaymessage is the object of textarea.
When i use this code it works fine for sometime and starts doing the opposite i.e its starts scrolling backwards so any new message is not displayed unless the scrollbar is scroll down.
I don't know tha actual logic behind the syntax but there must some a solution by setting its parameters obviously so that every time a text is appended to the Jtextarea the focus shifts on that specific string.
Also ... can this thing be possible with a JTextPane? i.e can text be appended to the JTextPane?
PLease help me
thanks in advance
[ July 19, 2003: Message edited by: raghav mathur ]
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raghav,
I this this does what you want...

HTH,
Abhik.
[ July 19, 2003: Message edited by: Abhik Sarkar ]
 
Raghav Mathur
Ranch Hand
Posts: 641
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
Thanks a ton. this is working !!!
I'll also test it online .
in the meanwhile can you please have answer my second question (JTextPane)
 
Raghav Mathur
Ranch Hand
Posts: 641
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can this thing be possible with a JTextPane? i.e can text be appended to the JTextPane?
Thanks in advance for your help
 
Raghav Mathur
Ranch Hand
Posts: 641
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
i could append text to the JtextPane

I,am not able to set the font and color to the JTextPane
 
Raghav Mathur
Ranch Hand
Posts: 641
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

With the help of this code i could embedd fonts and colors to the JTextPane but stil there is one more issue .
It accpets the currect color being assigned to it . ie it what ever color is being added to the JTextPane, it convert all the Text to that color .
Please tell me how to overcome this .
Thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic