public static void jarviz() {
        jButton1.setEnabled(false);
        jButton2.setEnabled(false);


        for (Shapes.Point point : points) {
            copyArray.add(point);
        }

        bestPoints = new ArrayList<Shapes.Point>();
        Shapes.Point cP = points.get(closestPoint());
        bestPoints.add(cP);
        points.remove(cP);
        points.add(cP);

        clearImage();
        showPoints();
        g.setColor(Color.GREEN);

        while (true) {
            int lastIndex = 0;
            for (int i = 0; i < copyArray.size(); i++) {
                if (myCompare(bestPoints.get(bestPoints.size() - 1), copyArray.get(lastIndex), copyArray.get(i)) == -1) {
                    g.setColor(Color.BLACK);
                    drawP(lastIndex);
                    lastIndex = i;
                    g.setColor(Color.BLUE);
                } else {
                    g.setColor(Color.RED);
                }
                drawP(i);
                jLabel1.update(jLabel1.getGraphics());
            }
            if (copyArray.get(lastIndex) == bestPoints.get(0)) {
                break;
            } else {
                bestPoints.add(copyArray.get(lastIndex));
                g.setColor(Color.GREEN);
                drawB();
                copyArray.remove(lastIndex);
                jLabel1.update(jLabel1.getGraphics());
            }
        }
        for (int i = 0; i < copyArray.size(); ++i) {
            g.setColor(Color.RED);
            if (!bestPoints.contains(copyArray.get(i))) {
                g.fillOval(copyArray.get(i).getX() - 5, copyArray.get(i).getY() - 5, 10, 10);
            }
        }
        for (int i = 0; i < bestPoints.size(); ++i) {
            g.setColor(Color.BLUE);
            g.fillOval(bestPoints.get(i).getX() - 5, bestPoints.get(i).getY() - 5, 10, 10);
        }
        g.setColor(Color.GREEN);
        g.drawLine(bestPoints.get(bestPoints.size() - 1).getX(), bestPoints.get(bestPoints.size() - 1).getY(),
                bestPoints.get(0).getX(), bestPoints.get(0).getY());

        copyArray = new ArrayList<Shapes.Point>();
        jButton1.setEnabled(true);
    }