public void keyPressed(KeyEvent e) {

    int key = e.getKeyCode();

    if (key == KeyEvent.VK_SPACE && !getMidair()) {
        setDY(-4 * Board.getInstance().getGravity());
        setMidair(true);
    }

    if (key == KeyEvent.VK_LEFT) {
        setDX(-2);
    }

    if (key == KeyEvent.VK_RIGHT) {
        setDX(2);
    }
    if (key == KeyEvent.VK_E) {
     Board.getInstance().toggleGravity();
     setDY(-0.5);
 }
}