Why would the anonymous inner class not be released here, causing a memory leak? This happens for FX 2.2.1.
anchorPane.getParent().getParent().lookup("#grandParentButton").addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent e) {
if (e.getCode() == KeyCode.ENTER) {
someButtonInsideAnchorPane.requestFocus();
e.consume();
}
}
});
Why would this below on the other hand be garbage collected?
button1InsideAnchorPane.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent e) {
if (e.getCode() == KeyCode.ENTER) {
button2InsideAnchorPane.requestFocus();
e.consume();
}
}
});