Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java JTextPane Save

 
i kurtz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was trying to do some simple text formatting using JEditorPane but then as knowledge grew i found JTextPane easier to implement and more robust.

my query is how do i save the formatted text in JTextPane to file? it should be RTF or HTML or other.. as this file is not opened by the application again.

it is a chat history text file with formatted text and should open as rtf in word or as html in internet explorer.

thank you.
 
Preston Taylor
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never tried formating as RTF but I have putput formatted HTML text to a file using the properties class and it held all the special characters etc from my text pane. I think that might work for you that way you can use the properties file like "Bill 11:15 PM" = "<HTML>blah blah <p>blah" as far as I know Properties works with any file extension. it just outputs straight text to whatever file you give it. This may not work easily if you just want plain text output (just out put your html tags etc as plain text it's fairly easy) use something like this:

CODE COPIED FROM JAVA2S.COM

keep in mind you can change that file extension to whatever you want. it doesn't have to be txt.


When in doubt google!
btw Java2s.com is a great site for noobs that need examples
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I. Kurz, please Be Forthright When Cross Posting To Other Sites.
 
i kurtz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am relatively new at this and i usually wait but regarding this topic i havent recieved any great guidence.

i will keep your tips in mind but i dont see the need for someone trying to hunt my posting down all over the place before providing me with a reason for their flame like postings.

hope you understand.

 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl doesn't hunt down anyone's posts, he just visits a lot of Java boards. That's why he's often the one to find these kinds of cross posts. And where did you see any flaming?
 
i kurtz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i said: flame like postings.... not actual flame.

it is the style and tone of reporting not the reporting itself.

he should have asked for an explanation politely instead of just mentioning cross post this and that.

nuff said.
 
Rob Camick
Ranch Hand
Posts: 2564
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but regarding this topic i havent recieved any great guidence.


You received the same suggestion in at least two different forums from two different people. I would call that great guidance.

Nowhere in any of your mulitple postings (that I have read) have you replied back stating what you do or don't understand.

hope you understand.


You should be understanding it from out point of view. We only have limited time to help people and would rather not spend it repeating answers that have been given elsewhere, when we could be helping others instead.
 
i kurtz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your view and my view differs.

the responses i have recieved so far are not suitable at present. this means im searching the web based on their tips and once i have made progress i hope to move on.

but strangly enough im havent made much progress so i posted across other forums also.

that is all that happened.

 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i kurtz wrote:this means im searching the web based on their tips and once i have made progress i hope to move on.

but strangly enough im havent made much progress so i posted across other forums also.


Actually it doesn't look like that. To me it just looks like you posted the identical question in four different places. There's no evidence that you considered the answers on one forum and then posted better questions elsewhere based on those answers.

However now that it's all in the open, it's no problem. Or are there other cross-posts of the question elsewhere which you need to tell us about?
 
i kurtz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no thats about it regarding posting.

i did not know i had to document everything when i ask a question in a forum before. i doubt that is the case for anyone.

im still searching the web but the threads of thought are not becoming interlinked like they usually do.. thats why the expansion..

any way.. i think we should quit now as both of our precious time could be invested better with other issues i.e. important ones.

thanks.
 
i kurtz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.javaprogrammingforums.com/file-i-o-other-i-o-streams/4218-java-jtextpane-save.html#post11565

sorry for the multiple posting.. was too stressed out! solution above.

glad i understood it.. took drastic limits to understand the solution but i managed it.

thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic