@Override
    public void startEvent(){
        if(valid == false){
            valid = true;
            graphP.resetGraph();
            graphK.resetGraph();

            try{
                newLength = convertToDF
                        (Double.parseDouble(lengthTextField.getText()));
                currentLength =  convertToDF
                        (Math.sqrt(Math.pow(line_pendulum.getStartX()
                        -line_pendulum.getEndX(),2)
                        +Math.pow(line_pendulum.getStartY()
                        -line_pendulum.getEndY(),2)));
                mass = convertToDF(Double.parseDouble
                        (massTextField.getText())); 

                if(newLength < 0 || newLength > 500 
                        || mass < 0 || mass > 100){
                    throw new Exception();
                }

                setValues();
                
                zeroPosition = currentLength+200;

                zeroPosition = currentLength+200;
                mechanicalE = (mass/1000)*ACCELERATION*currentLength;

                setAllButtons(true);
                playAnimation();
            }catch(Exception o){
                JOptionPane.showMessageDialog(null, 
                        "Please enter a correct value for all inputs");
            }
        }else{
            setAllButtons(true);
            playAnimation();
        }    
    }