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.
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.
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.
WebView
based solution berry links with the eclipse compiler for java to create a mini ide which I named conception. –
Asymmetric RichTextFX let's you specify style classes for ranges of text. Take a look at the Java keywords demo and its source code.
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.
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
© 2022 - 2024 — McMap. All rights reserved.