• 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

setting focus on the appended text in JTextArea

 
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic