0 points

How to add a mouse doubleclick event listener to the cells of a ListView in javafx? - Stack Overflow


dashboard

Thu Dec 03 2020 16:35:03 GMT+0000 (UTC)

Posted by @jasoncriss

playList.setOnMouseClicked(new EventHandler<MouseEvent>() {

    @Override
    public void handle(MouseEvent click) {

        if (click.getClickCount() == 2) {
           //Use ListView's getSelected Item
           currentItemSelected = playList.getSelectionModel()
                                                    .getSelectedItem();
           //use this to do whatever you want to. Open Link etc.
        }
    }
});
content_copy Copy

can also use % 2 == 0

https://stackoverflow.com/questions/22542015/how-to-add-a-mouse-doubleclick-event-listener-to-the-cells-of-a-listview-in-java