Jump to content

Best way to make a simple text editor

- - - - -

  • Please log in to reply
1 reply to this topic

#1
vaironl

vaironl

    Programmer

  • Members
  • PipPipPipPip
  • 117 posts
There is a fairly complicated ( for me ) application I'm making for my computer science class. Is a recipe organizer ( or Database).

I want the user to be able to align their highlighted text and change its color, font, and size.
What is the best way to do this since I will store my data in a text file.. Or is impossible?

#2
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
You will lose the formatting if you decide to store it as plain text. What you'll need to do is decide on what kind of encoding to use for the formatting.

If you use a JEditorPane, it supports HTML markup, which should easily provide all the formatting options you require. HTML should store just fine as text in a database.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users