Allow user to copy data from TableView


I have a simple JavaFX app that allows the user to query a database and see the data in a table.

I'd like to allow the user to be able to click a table cell and copy text from that cell to the clipboard with the standard clipboard key stroke: ctrl-c for Win/Linux or cmd-c for Mac. FYI, the text entry controls support basic copy/paste by default.

I'm using the standard javafx.scene.control.TableView class. Is there a simple way to enable cell copy? I did some searches and I see other people create custom menu commands... I don't want to create a custom menu, I just want basic keyboard copy to work with single cells.

I'm using single selection mode, but I can change to something else if need be:

    TableView<Document> tableView = new TableView<Document>();
8/6/2014 9:01:57 PM

I recommended that you review this post, work for me

The author use an aditional util java class for enable the cell content copy from a tableView

6/30/2016 8:44:01 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow