Added event handler for the delete key

This commit is contained in:
0xboobface 2018-07-11 18:48:52 +02:00
parent 8a43654712
commit ba389744d7
1 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,8 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.ContextMenuEvent;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
@ -124,6 +126,14 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
popup.hide();
}
});
table.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if(event.getCode() == KeyCode.DELETE) {
JavaFxRecording recording = table.getSelectionModel().getSelectedItem();
if(recording != null) {
delete(recording);
}
}
});
scrollPane.setContent(table);
BorderPane root = new BorderPane();