My goal is to detect when a user double clicks a cell in the TableView
and use the information from that cell. From my picture you can see I will have a table of beers, breweries, and style.
Upon double clicking a cell I want to show the user an image (of the beer, a brewery) with some info. I am using scene builder as well, so I am dealing with controller classes. So far what I have is this but no luck. No errors, just doesn't pull the info when I attempt a basic test.
FYI: I want to detect the click on one cell, and ONLY pull info from the cell clicked - not the entire row.
Here is my code for the event.
public void clickItem(MouseEvent event) {
tableID.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
System.out.println("Clicked on " + (tableID.getSelectionModel().getSelectedCells().get(0)).getColumn());
}
});
}
println
when clicking? Your method looks a bit peculiar. Could you also post the code fragment where it is called? And what istableID
? It looks a bit like when you click on an item you register the event handler. – Dionnadionne