'How to make textflow selectable
I have made a TextFlow, as I need to use multiple font-postures (I have set particular "Text" to either italic or normal). Once I display the TextFlow, it's not selectable/copyable. All I need is the TextFlow to be selectable once it's displayed in a scene, so it can be copy/paste-able.
Text example with font-posture (only one for examples sake):
Text volumeText = new Text(volume.getText());
volumeText.setFill(Color.WHITE);
volumeText.setFont(Font.font("arial", FontPosture.ITALIC, 13));
TextFlow reference = new TextFlow(
lastNameText, miscelanous1, firstNameText, miscelanous2);
reference.setLayoutX(115);
reference.setLayoutY(480);
reference.setMaxWidth(500);
control.getChildren().add(reference);
Solution 1:[1]
I think I got a nasty way of doing the similar job
Text could sense the mouse enter & exit move event
We could set a signal for mouse pressed and release event. Would be nice to have this event triggered on Textflow node
extends Text class to have mouse enter event handler, when the global signal is on and mouse enters text then copy the text to some places and also record the text place in the textflow using sth. like var index = textflow.getChildren().indexof(text) record the pair of index and text
when mouse release or exit event are triggered, sort the texts selected and generate the corresponding texts into clipboard
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chengen Zhao |
