Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX code editor with content highlighter for Java Code

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.

like image 787
Sangram Mohite Avatar asked May 02 '13 11:05

Sangram Mohite


2 Answers

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.

like image 149
Michael Berry Avatar answered Oct 05 '22 04:10

Michael Berry


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

like image 44
Tomas Mikula Avatar answered Oct 05 '22 02:10

Tomas Mikula