public void keyReleased(KeyEvent e) { //stops the paddle from moving when the key is released
        int key = e.getKeyCode();

        if (key == KeyEvent.VK_LEFT) { //set to 0, hence no motion
            dx = 0;
        }

        if (key == KeyEvent.VK_RIGHT) { //set to 0, hence no motion
            dx = 0;
        }
    }