@Override
    public void keyPressed(KeyEvent e) {
        traceKeyEvents(e);

        switch (e.getKeyCode()) {
            case KeyEvent.VK_LEFT:
            case KeyEvent.VK_NUMPAD4:
            case KeyEvent.VK_A:
                deltaX--;
                xPosition = xPosition + deltaX;
                if (xPosition < 0)
                    xPosition = canvasWidth;
                repaint();
                break;
            case KeyEvent.VK_RIGHT:
            case KeyEvent.VK_NUMPAD6:
            case KeyEvent.VK_D:
                deltaX++;
                xPosition = xPosition + deltaX;
                if (xPosition > canvasWidth)
                    xPosition = 0;
                repaint();
                break;
        }
    }