How to add a mouse doubleclick event listener to the cells of a ListView in javafx? - Stack Overflow
Thu Dec 03 2020 16:35:03 GMT+0000 (UTC)
Saved 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_copyCOPY
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
Comments
@Fraxxinus - Fri Jan 07 2022 20:08:57 GMT+0000 (UTC)How can you use the Object you get (currentItemSelected)? Like fe, how do I get a String out of this, when I first wrote a String to the ListView?