private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        try {
            int generat = (int) spingen.getValue();
            int popul = (int) spinpopul.getValue();
            double ci = (double) spincross.getValue();
            double mc = (double) spinmutchrom.getValue();
            double mg = (double) spinmutgen.getValue();
            Solve res;
            long start = System.currentTimeMillis();
            genetic gen = new genetic(gr.getCount(), gr.getM(), generat, popul, ci, mc, mg);
            res = gen.genetic();
            res.paint(gr.getPnts(), g);
            long finish = System.currentTimeMillis();
            timegen.setText(""+(finish-start));
            chromgen.setText(Integer.toString(res.Value));
            if (res.Value > gr.getCount()) // TODO add your handling code here:
            {
                JOptionPane.showMessageDialog(null, "FAIL");
            }
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton2ActionPerformed