@Override
    public void mousePressed (MouseEvent e) {
        if (alg.isProcess()) {
            return;
        }

        alg.reset();

        int i = getRowByMouseX(e.getX());
        int j = getColumnByMouseY(e.getY());

        if (alg.getCell(i, j) instanceof StartCell) {
            draggedCell = new StartCell();

        } else if (alg.getCell(i, j) instanceof EndCell) {
            draggedCell = new EndCell();

        } else {
            draggedCell = null;
        }
    }