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

Can i store bold/italic text modified in JTextpane in Database??  RSS feed

 
Manjit Barman
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyboy give me any idea, if i can store a text attribute (like bold, italic etc) modified in JTextPane in Oracle 9i Database?
The user should be able to modify the text attribute, then store that in DB and again retrieve them from DB when in need, in the same attribute style.

Thanks a lot!
 
Jared Cope
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As one solution, you would need to add a column in your database table to specify the style to apply to the saved text in that database row.

When you query the database for the text to re-display it, you would also need to look at this column to figure out how to render the text in the JTextPane (eg, should it be bold, italic etc).

You can't save styled text in the database as such. There is no 'sytled text column' type in Oracle, or any other database that I know of.

Cheers, Jared.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!