2

I was wondering if there was a library or something that could indent and embellish a code in a JTextArea instead of an ugly plain text ?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332

2 Answers2

1

If you want a syntax hightlight, you could use RSyntaxTextArea, a text component for Java Swing. Check: http://fifesoft.com/rsyntaxtextarea/

Diogo Moreira
  • 1,082
  • 2
  • 9
  • 24
  • That's exactly what I want, is that a library that I have to import or something ? Because when I downloaded the file I got a bunch of folders with the package inside but when I run it in my code using RTextArea it crashes saying : **Can't find bundle for base name org.fife.ui.rtextarea.RTextArea** –  May 29 '13 at 19:16
  • For me, I just added the dependency on pom.xml. Are you using Maven? – Diogo Moreira May 29 '13 at 19:17
  • @nicnhus Can't tell exactly what to do now... I'm not on my pc. :( – Diogo Moreira May 29 '13 at 19:24
  • Well, thanks for helping :) Maybe you can just tell me if you imported the download file as a new project or if you added it as a new library inside your project ? –  May 29 '13 at 19:27
  • I use Maven instead, so there's no need to do none of these options, just add the dependency on the pom.xml – Diogo Moreira May 29 '13 at 19:39
  • Look [here](http://stackoverflow.com/questions/6391861/java-importing-the-rsyntaxtextarea-library) for a previous answer to getting `RSyntaxTextArea` – Arend May 29 '13 at 20:42
1

How sophisticated do you want your formatting to be? RSyntaxTextArea is very nice but fairly heavyweight; you can instead get HTML formatting in a (standard Swing) JTextPane.

Arend
  • 2,363
  • 1
  • 18
  • 18
  • Thanks a lot for noticing this, I used it and it works perfectly fine ! –  May 30 '13 at 12:19