aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Saving MetaData of 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 "Saving MetaData of JTextArea" Watch "Saving MetaData of JTextArea" New topic
Author

Saving MetaData of JTextArea

tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Hi

I am planing to make a small application having my personal diary.
What I want is to put some text in JTextArea and when the user will click save , it should be stored as encrypted text i.e. before sending to DB ill encrypt that.

But , the question is I want rtf features in my Text i.e bold,italic etc so how to encrypt and decrypt this metadata.

Do I have to use XML for this ?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Moving to Swing/AWT


[Jess in Action][AskingGoodQuestions]
John G Martinson
Greenhorn

Joined: Jul 25, 2005
Posts: 8
If you want to use Rich Text Formatting you might want to use JTextPane. It handles that sort of things and a whole lot more.

As for saving the formatting information, you do have the option of using XML. This will require that you figure out/find an XML structure to handle that.

On the other hand, JTextPane implements the serializable interface. This interface allows a class to be put in a linear format so that it can be passed into an io stream and re-instantiated into a working object.

I'm not sure exactly how that works in code, as I have never actaully done it myself, but that would probably be the easiest way to do it.

In the API doc it mentions that there will be compatibility issues from version to version and a better solution to take care of that.

Good luck.


A little wiser for the wear.
tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Thanks John , the second option looks good.I am trying to implement this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving MetaData of JTextArea