Sangram Mohite
Sangram Mohite

Reputation: 754

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.

Upvotes: 6

Views: 12361

Answers (4)

Michael Sims
Michael Sims

Reputation: 2523

For any current searchers with this question, MonacoFX is a very nice, convenient, and EASY to use library that offers feature-rich code editing with at least 50 or 75 languages that it can properly syntax highlight, code fold, and all that good stuff. It is the same code editor that is used in the open-source version of Visual Studio. When I built my app and integrated MonacoFX, it was literally the most effortless portion of my project.

Upvotes: 2

mindlid
mindlid

Reputation: 2656

You can use eclipse text framework as posted

They also have a javafx code editor component called compensator

you can use intellij's swing code editor, with javafx swing interoperability

the component is com.intellij.openapi.editor.impl.EditorComponentImpl

you can check details running with intellij integrated ui inspector

Upvotes: 0

Tomas Mikula
Tomas Mikula

Reputation: 6537

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

Upvotes: 9

Michael Berry
Michael Berry

Reputation: 72304

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.

Upvotes: 10

Related Questions