monacofx

Powerful editor node based on Monaco

License

License

MIT
GroupId

GroupId

eu.mihosoft.monacofx
ArtifactId

ArtifactId

monacofx
Last Version

Last Version

0.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

monacofx
Powerful editor node based on Monaco
Project URL

Project URL

https://github.com/miho/MonacoFX
Source Code Management

Source Code Management

https://github.com/miho/MonacoFX.git

Download monacofx

How to add to project

<!-- https://jarcasting.com/artifacts/eu.mihosoft.monacofx/monacofx/ -->
<dependency>
    <groupId>eu.mihosoft.monacofx</groupId>
    <artifactId>monacofx</artifactId>
    <version>0.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/eu.mihosoft.monacofx/monacofx/
implementation 'eu.mihosoft.monacofx:monacofx:0.0.7'
// https://jarcasting.com/artifacts/eu.mihosoft.monacofx/monacofx/
implementation ("eu.mihosoft.monacofx:monacofx:0.0.7")
'eu.mihosoft.monacofx:monacofx:jar:0.0.7'
<dependency org="eu.mihosoft.monacofx" name="monacofx" rev="0.0.7">
  <artifact name="monacofx" type="jar" />
</dependency>
@Grapes(
@Grab(group='eu.mihosoft.monacofx', module='monacofx', version='0.0.7')
)
libraryDependencies += "eu.mihosoft.monacofx" % "monacofx" % "0.0.7"
[eu.mihosoft.monacofx/monacofx "0.0.7"]

Dependencies

runtime (5)

Group / Artifact Type Version
org.openjfx : javafx-base jar 12.0.1
org.openjfx : javafx-controls jar 12.0.1
org.openjfx : javafx-web jar 12.0.1
org.openjfx : javafx-media jar 12.0.1
org.openjfx : javafx-graphics jar 12.0.1

Project Modules

There are no modules declared in this project.

MonacoFX

Download

JavaFX editor node based on the powerful Monaco editor that drives VS Code

Using MonacoFX

Using MonacoFX is straightforward. Just create a MonacoFX node and add it to the scene graph. Here's a an example on how to use MonacoFX with syntax highlighting and code folding for an existing language:

public class App extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {

        // create a new monaco editor node
        MonacoFX monacoFX = new MonacoFX();
        StackPane root = new StackPane(monacoFX);

        // set initial text
        monacoFX.getEditor().getDocument().setText(
                "#include <stdio.h>\n" +
                "int main() {\n" +
                "   // printf() displays the string inside quotation\n" +
                "   printf(\"Hello, World!\");\n" +
                "   return 0;\n" +
                "}");

        // use a predefined language like 'c'
        monacoFX.getEditor().setCurrentLanguage("c");
        monacoFX.getEditor().setCurrentTheme("vs-dark");

        // the usual scene & stage setup
        Scene scene = new Scene(root, 800,600);
        primaryStage.setTitle("MonacoFX Demo (running on JDK " + System.getProperty("java.version") + ")");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

Visit the MonacoFX tutorial projects and learn more about advanced topics, such as adding custom language support and code folding.

How To Build The Project

1. Dependencies

  • JDK >= 11 (tested with JDK 13)
  • Internet Connection (other dependencies will be downloaded automatically)
  • Optional: IDE with Gradle support

2. Building

IDE

To build the project from an IDE do the following:

  • open the Gradle project
  • call the assemble Gradle task to build the project

Command Line

Building the project from the command line is also possible.

Navigate to the project folder and call the assemble Gradle task to build the project.

Bash (Linux/OS X/Cygwin/other Unix-like OS)
cd Path/To/MonacoFX
./gradlew assemble
Windows (CMD)
cd Path\To\MonacoFX
gradlew assemble

3. Running the sample App

IDE

To run the project from an IDE do the following:

  • open the Gradle project
  • call the run Gradle task to run the project

Command Line

Running the project from the command line is also possible.

Navigate to the project folder and call the run Gradle task to run the project.

Bash (Linux/OS X/Cygwin/other Unix-like OS)
cd Path/To/MonacoFX
./gradlew run
Windows (CMD)
cd Path\To\MonacoFX
gradlew run

Versions

Version
0.0.7
0.0.6
0.0.5
0.0.4
0.0.1