This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextPane , StyledDocument  RSS feed

 
Loganathan Subramani
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I developing a chatter application, I used JTexPane with StyledDocument. And i am inserting string with timestamp in to StyledDocument like below

[22/04/2009 15:22]nathan: hai
[22/04/2009 15:22]nathan: how ru
[22/04/2009 15:22]nathan: i am fine

After that if i wish to hide/show time stamp means the textpane should be modified like

nathan: hai
nathan: how ru
nathan: i am fine

if i give show it should show again the same timestamp...
Is it possible..? if so can i have the logic or sample code...

I am using the code is


But there is no change in textpane.. please provide me the best way to get my requirement

Thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you got so far?
 
Loganathan Subramani
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i clicked hide button i m changing TimeStamp object to ""; but it didn't reflect in styledDoc


its used in yahoo chat window..... like time stamp show/hide option....
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use code tags
http://faq.javaranch.com/java/UseCodeTags

When the user selects show / hide, where are you resetting/reloading the style doc?
 
Loganathan Subramani
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am resetting doc in public void setTimeStampVisible(boolean flag) method you can see my full code in my previous post itself..

 
Loganathan Subramani
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any other option for dynamic content at text editor in swing program..? if so please suggest me.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!