@Override
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = super.keyPressed(component, keyCode, keyLocation);
FileBrowser fileBrowser = (FileBrowser)getComponent();
if (keyCode == Keyboard.KeyCode.ENTER
&& keyboardFolderTraversalEnabled) {
Sequence<File> selectedFiles = fileBrowser.getSelectedFiles();
if (selectedFiles.getLength() == 1) {
File selectedFile = selectedFiles.get(0);
if (selectedFile.isDirectory()) {
fileBrowser.setRootDirectory(selectedFile);
consumed = true;
}
}
} else if (keyCode == Keyboard.KeyCode.DELETE
|| keyCode == Keyboard.KeyCode.BACKSPACE) {
File rootDirectory = fileBrowser.getRootDirectory();
File parentDirectory = rootDirectory.getParentFile();
if (parentDirectory != null) {
fileBrowser.setRootDirectory(parentDirectory);
consumed = true;
}
} else if (keyCode == Keyboard.KeyCode.F5) {
refreshFileList();
consumed = true;