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.
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.
A little wiser for the wear.
Joined: Apr 05, 2004
Thanks John , the second option looks good.I am trying to implement this