aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes setting focus on the appended text in JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setting focus on the appended text in JTextArea" Watch "setting focus on the appended text in JTextArea" New topic
Author

setting focus on the appended text in JTextArea

Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
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 ]

Raghav.
Abhik Sarkar
Ranch Hand

Joined: Jun 14, 2003
Posts: 61
Hi Raghav,
I this this does what you want...

HTH,
Abhik.
[ July 19, 2003: Message edited by: Abhik Sarkar ]
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
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

Joined: Jan 12, 2001
Posts: 641
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

Joined: Jan 12, 2001
Posts: 641
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

Joined: Jan 12, 2001
Posts: 641

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting focus on the appended text in JTextArea