1

I'm currently developing JTextArea with a Notepad++ like function (currently indentation function finished).

Now I'm trying to add a function which in my JTextArea will show a dotted line for an indentation with same level, and change specific color of a word.

Thanks in advance :)

mKorbel
  • 109,525
  • 20
  • 134
  • 319
A-SM
  • 882
  • 2
  • 6
  • 18
  • Nope, I don't have a clue on drawing color inside JTextArea. I tried to change JTextArea forecolor but it affects all the words. – A-SM Jun 05 '13 at 06:21
  • a dotted line for an indentation with same level, and change specific color of a word. are you meaning underline – mKorbel Jun 05 '13 at 06:25
  • No, not an underline, but a straight vertical line. – A-SM Jun 05 '13 at 06:27
  • 1
    Here is one related [example](http://stackoverflow.com/q/9650992/1057230). If I understood the concept, I guess you might want to create an application which is similar to `JEdit/Notepad2/Notepad++`, then I guess you can use the concept of `JTree`, since that will allow you to fold your function definition as an when required, as seen in many advance IDEs now a days :-) – nIcE cOw Jun 05 '13 at 08:13

1 Answers1

4

You will not able to achieve your target with JTextArea as it is a plain text support component.You have to use a Styled text supported JEditorPane or JTextPane.And try to use a HTML document and achieve it.Look at

Styled supported components

and

some more examples

Sanjaya Liyanage
  • 4,706
  • 9
  • 36
  • 50