So I'm getting a NullPointerException at Container.add so I'm obviously missing something I just don't see it. ArrayList is of Cell which extends JButton. The method init() is in an extended JPanel class. This is my frist question so be harsh on question format if I'm doing it wrong, Thank you.
public void init() {
int k = cells.length / 2;
for (int i = 0; i < (cells.length / 2); i++) {
int ID = rand.nextInt(25);
cells[i] = new Cell(this, ID);
cells[i + k] = new Cell(this, ID);
k--;
cellList.add(cells[i]);
cellList.add(cells[i + k]);
}
Collections.shuffle(cellList);
for (Cell cell : cellList) {
add(cell);
}
}