I have a simple JavaFX application that allows a user to query a database and view data in a table.
I want the user to be able to click on a table cell and copy the text from this cell to the clipboard with a standard bar as a clipboard: ctrl-c for Win / Linux or cmd-c for Mac. FYI, text input elements support the base copy / paste by default.
I am using the standard javafx.scene.control.TableView class. Is there an easy way to make a copy of a cell? I did some searches, and I see other people creating custom menu commands ... I don't want to create a custom menu, I just want the main keyboard copy to work with individual cells.
I use single selection mode, but if necessary, I can change something else:
TableView<Document> tableView = new TableView<Document>(); tableView.getSelectionModel().setCellSelectionEnabled(true); tableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
source share