TextFlow vs TextArea, layout issues; Why did TextFlow mess it up where TextArea isn't?

Here is the source fxml file (import is omitted for brevity):

<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
    minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0"
    xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
    fx:id="pane"
    fx:controller="com.github.parboiled1.grappa.debugger.mainwindow.MainWindowUi">
    <top>
        <MenuBar BorderPane.alignment="CENTER">
            <Menu mnemonicParsing="false" text="File">
                <!-- INJECTION -->
                <MenuItem fx:id="loadInput" mnemonicParsing="false"
                    text="Load file" onAction="#loadFileEvent"/>
                <MenuItem fx:id="parse" mnemonicParsing="false"
                    text="Parse" onAction="#parseEvent"/>
                <MenuItem fx:id="closeButton" mnemonicParsing="false"
                    text="Close" onAction="#closeWindowEvent"/>
            </Menu>
        </MenuBar>
    </top>
    <center>
        <SplitPane dividerPositions="0.5" prefHeight="160.0" prefWidth="200.0"
            BorderPane.alignment="CENTER">
            <SplitPane dividerPositions="0.5" orientation="VERTICAL">
                <TreeView fx:id="traceTree" prefHeight="200.0"
                    prefWidth="200.0" style="font-family: monospace"/>
                <TextArea fx:id="traceDetail" editable="false"
                    prefHeight="200.0" prefWidth="200.0"
                    style="-fx-font-family: monospace"/>
            </SplitPane>
            <!-- HERE -->
            <TextArea fx:id="inputText" prefHeight="200.0" prefWidth="200.0"/>
        </SplitPane>
    </center>
</BorderPane>

I want to perform text selection of a part of the text in what is currently TextAreawith fx:idfrom inputText. For this, I was recommended to use TextFlowinstead TextArea. "The XML Comment": HERE.

I already have an β€œXML comment” INJECTION, a way to populate the contents with the inputTextcontents of a (text) file. This works great with TextArea.

Now, what I did: I just replaced TextAreawith TextFlow, adapted the code and it. Nothing else.

, . , :

Before load

, , TextFlow , ... , :

enter image description here

TextArea. "" ( ) MenuBar , .

a TextArea ... TextFlow.

TextFlow behave, "layout-wise", TextArea?

+4
1

TextArea , , . TextFlow , . TextFlow, , TextFlow ScrollPane:

<ScrollPane>
    <TextFlow fx:id="inputText" ... />
</ScrollPane>

. ,

<ScrollPane fitToWidth="true">

( TextFlow) ( , ). ScrollPane Javadocs , .

+7

All Articles