I have TableView
and I want to do something when the cell loses the focus. I have cell selection enabled on this TableView
and it doesn't listens to cell focus lost. I tried this way:
table.getFocusModel().focusedCellProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
//doSomething
}
// else doSomethingElse doesn't work
});
Simply it doesn't listen when I deselect (Ctrl + click) the cell. What did I wrong or how can I listen to focus lost on a TableCell
?
I'm using this:
TABLEVIEW.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (newPropertyValue) {
System.out.println("on focus");
} else {
System.out.println("out focus");
}
}
});
It works only if you select another selectable element (doesn't work eg clicking on a pane).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.