private void btnGenStadoActionPerformed(ActionEvent evt) {//GEN-FIRST:event_btnGenStadoActionPerformed
       mainBoids.panelSizeX=(int)spnWidth.getValue();
       mainBoids.panelSizeY=(int)spnHeight.getValue();
       
        fabric= new boidsFabric();
       fabric.setBoidsParametrs(sldMaxSpeed.getValue()/100d,sldMaxAccel.getValue()/10d,sldMass.getValue()/50d,sldSkala.getValue()/2d);

       mainBoids.boids=fabric.createBoids(Integer.parseInt(this.txtNumSwarm.getText()),(int)this.textNumPred.getValue(),(double)this.sldPerHunger.getValue()/100);
    
       obsfabric = new obstaclesFabric();
       mainBoids.obs = obsfabric.createObs((int)textNumObs.getValue(),this.getObstacleSize());// dorobić pole na ilośc przeszkód i wartość tutaj
       ffabric=new foodFabric();
       mainBoids.food=ffabric.createFood((int)textNumFood.getValue());
       mainBoids.stat=new statistic(Integer.parseInt(this.txtNumSwarm.getText()),(int)this.textNumPred.getValue(),(int)this.textLeaderNum.getValue());
       if (ptr!=null){this.remove(ptr);}
       //ptr=new panel(mainBoids.boids,mainBoids.prey);
       btnSterMysza.setSelected(false);
       btnSterMysza1.setSelected(false);
       btnSterMysza3.setSelected(false);
       ptr=new panel(mainBoids.boids,mainBoids.obs,mainBoids.food);
       this.add(ptr);  
//        ptr.addMouseListener(new java.awt.event.MouseAdapter() {
//            public void mouseClicked(java.awt.event.MouseEvent evt) {
//                panelMouseClicked(evt);
//            }
//        });
//        ptr.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
//            public void mouseMoved(java.awt.event.MouseEvent evt) {
//                panelMouseMoved(evt);
//            }
//        });

//       ptr.addKeyListener(new java.awt.event.KeyAdapter() {
//            public void keyTyped(java.awt.event.KeyEvent evt) {
//                panelKeyTyped(evt);
//            }
//        });
       ptr.repaint();
       this.btnStart.setText("Rozpocznij symulację");
       if (mainBoids.simul!=null)mainBoids.simul.continueSimulation=false;
       this.btnStart.setEnabled(true);
    }