public void setMatrix(String str) {
        String[] row_strings = str.split(";");
        if (row_strings.length != height)
            return;
        
        int[][] new_array2d = new int[height][width];        
        
        String[] row_list;
        for (int j=0; j<height; j++) {
            row_list = row_strings[j].split(",");
            
            if (row_list.length != width)
                return;
                        
            for (int i=0; i<width; i++) {
                new_array2d[j][i] = Integer.valueOf(row_list[i]);
            }
        }
        
        array2d = new_array2d;
        updateLengths();
    }