JavaFX code editor with content highlighter for Java Code


Question

I want to write a text editor in JavaFX which acts similar to Eclipse/Netbeans IDE to highlight the Java code. Can anyone suggest as to how it can be achieved or anyone has done this previously.

Thanks.

1
6
5/2/2013 11:47:34 AM

Accepted Answer

There's no pure JavaFX libraries for the code highlighting / editing as far as I know, so if you want to implement it in JavaFX you're going to be translating from a similar Swing (or other) project, or you're on your own.

However, you can use such a Javascript library and wrap it in a WebView if you want to achieve this - Jewelsea (who often swings by here) has done just this and explained it rather nicely here.

10
5/2/2013 11:57:12 AM

RichTextFX let's you specify style classes for ranges of text. Take a look at the Java keywords demo and its source code.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon