@Override
    public void keyReleased(final KeyEvent event) {
        switch (event.getKeyCode()) {
        case KeyEvent.VK_ESCAPE:
            mainFrame.dispose();
        case KeyEvent.VK_LEFT: {
            if (tabPane.getTabCount() == 0) {
                return;
            }
            int index = tabPane.getSelectedIndex();
            index -= 1;
            if (index < 0) {
                index = tabPane.getTabCount() - 1;
            }
            index %= tabPane.getTabCount();
            tabPane.setSelectedIndex(index);
        }
            break;
        case KeyEvent.VK_RIGHT: {
            if (tabPane.getTabCount() == 0) {
                return;
            }
            int index = tabPane.getSelectedIndex();
            index += 1;
            index %= tabPane.getTabCount();
            tabPane.setSelectedIndex(index);
        }
            break;
        case KeyEvent.VK_DELETE:
            if (tabPane.getTabCount() == 0) {
                return;
            }
            tabPane.remove(tabPane.getSelectedIndex());
            break;
        case KeyEvent.VK_R:
            getCurrentTabImage().reset();
            break;

        default:
            // ignore
            break;
        }
    }