Replace TextFlow with RichTextFX CodeArea

This commit is contained in:
Oystein Kristoffer Tveit 2021-02-17 15:40:50 +01:00
parent 45e3e914e8
commit 3f591b07e0
3 changed files with 18 additions and 10 deletions

View File

@ -18,3 +18,5 @@
## Credits/Sources
- [james-d/SimpleMVP](https://github.com/james-d/SimpleMVP/tree/master/src/examples/mvp) -> Demonstration of JavaFX Model/View/Controller application
- [FXMisc/RichtTextFX](https://github.com/FXMisc/RichTextFX) -> Library for handling rich text and line numbers
- [richtextfx-demos](https://github.com/FXMisc/RichTextFX/blob/master/richtextfx-demos/README.md) -> Examples and demos of how to use RichTextFX, including [Java Keywords Demo](https://github.com/FXMisc/RichTextFX/blob/master/richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/JavaKeywordsAsyncDemo.java)

View File

@ -28,6 +28,13 @@
<version>16-ea+7</version>
</dependency>
<!-- RichTextFX -->
<dependency>
<groupId>org.fxmisc.richtext</groupId>
<artifactId>richtextfx</artifactId>
<version>0.10.5</version>
</dependency>
<!-- JUnit 5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
@ -35,7 +42,7 @@
<version>5.8.0-M1</version>
</dependency>
<!-- TextFX -->
<!-- TestFX -->
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-core</artifactId>

View File

@ -13,6 +13,8 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.text.TextFlow?>
<?import org.fxmisc.flowless.VirtualizedScrollPane?>
<?import org.fxmisc.richtext.CodeArea?>
<BorderPane
prefWidth="600"
@ -59,21 +61,18 @@
</ScrollPane>
<!-- Editor -->
<ScrollPane>
<content>
<TextFlow
id="editor"
prefHeight="${editor.parent.height}"
prefWidth="${editor.parent.width}"/>
</content>
</ScrollPane>
<VirtualizedScrollPane>
<content>
<CodeArea fx:id="editor"/>
</content>
</VirtualizedScrollPane>
</items>
</SplitPane>
</center>
<bottom>
<HBox id="modeline" prefHeight="25.0">
<HBox fx:id="modeline" prefHeight="25.0">
<Label text="Modeline :)"/>
</HBox>
</bottom>