Algorithm in Netbeans Projet with graphical display