JavaFX code editor with content highlighter for Java Code
Asked Answered
T

4

6

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.

Tricrotic answered 2/5, 2013 at 11:47 Comment(0)
D
10

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.

Discontented answered 2/5, 2013 at 11:57 Comment(4)
I've published serval blog posts and source code. I've tried both paths: * embedding a webview and using Orion-Editor written in JS (tomsondev.bestsolution.at/2012/10/04/eclipse-techs-on-steroids) * writing a native one (tomsondev.bestsolution.at/2013/03/11/…)Sequin
@Sequin Nice work! Will it be a free / open product when completed?Discontented
the sources are all free (EPL) and can be found in my github repo at github.com/tomsontom/e-fx-clipse and github.com/tomsontom/fx-ideSequin
I integrated the WebView based solution berry links with the eclipse compiler for java to create a mini ide which I named conception.Asymmetric
S
9

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

Symphonist answered 7/10, 2013 at 23:20 Comment(1)
Please dont get this, its so frustrating to work with... Im trying to find alternative solutions. I think at this moment in time the best solution would be to use a webview to show a css/javascript code editor like AceRinee
G
2

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.

Gaytan answered 5/12, 2021 at 10:15 Comment(0)
T
0

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

Textualism answered 16/9, 2021 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.