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.

4 Answers 4

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.

Sign up to request clarification or add additional context in comments.

4 Comments

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/…)
@tomsontom Nice work! Will it be a free / open product when completed?
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-ide
I integrated the WebView based solution berry links with the eclipse compiler for java to create a mini ide which I named conception.
9

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

1 Comment

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 Ace
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.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.