public void keyPressed(KeyEvent e) { //sets the motion of the balls

        int key = e.getKeyCode(); //gets the key pressed

        if (key == KeyEvent.VK_LEFT) { //if it's left, the ball changes its position with -2x (-1x direction == left)
            dx = -2;

        }

        if (key == KeyEvent.VK_RIGHT) { ////if it's left, the ball changes its position with 2x (+1x direction == right)
            dx = 2;
        }
    }