Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Stuff");
alert.setContentText(messageIWannaCopy());
conf.show();
I'm creating an alert in JavaFX. But I'd like the user to be able to copy the message to the clipboard. How can I do that? By default it looks like a standard label, which doesn't allow that.
this might what you need
TextArea textArea = new TextArea("YOUR_MESSAGE_HERE");
textArea.setEditable(false);
textArea.setWrapText(true);
GridPane gridPane = new GridPane();
gridPane.setMaxWidth(Double.MAX_VALUE);
gridPane.add(textArea, 0, 0);
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Stuff");
alert.getDialogPane().setContent(gridPane);
alert.showAndWait();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With