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);
Text and TextFlow in JavaFX are not "selectable".
There is an issue open for this : Text should have API for selecting group of characters based on their position similar to the DOM's Range.
Until the issue is taken care of, your best option is to use a 3rd party control like RichTextFX.