public void setSudokuPuzzle(SudokuPuzzle sudokuPuzzle) { this.sudokuPuzzle = sudokuPuzzle; removeAll(); setLayout( new java.awt.GridLayout( sudokuPuzzle.getSudoku().getSettings().getSquareWidthCount(), sudokuPuzzle.getSudoku().getSettings().getSquareHeightCount())); for (List<List<List<Cell>>> squareRow : getSudokuPuzzle().getSudoku().getSquares()) { for (List<List<Cell>> square : squareRow) { SquarePanel squarePanel = new SquarePanel(colorSettings); colorSettings.addColorSettingsListener(squarePanel); squarePanel.setLayout( new java.awt.GridLayout( sudokuPuzzle.getSudoku().getSettings().getSquareWidth(), sudokuPuzzle.getSudoku().getSettings().getSquareHeight())); squarePanel.setBackground( getComponentCount() % 2 == 0 ? colorSettings.getColor(UIConstants.DARK_SQUARE) : colorSettings.getColor(UIConstants.LIGHT_SQUARE)); // squarePanel.setOpaque(false); for (List<Cell> row : square) { for (Cell cell : row) { CellPanel cellPanel = new CellPanel(); cellPanel.setCell(cell); cellPanel.update(sudokuPuzzle.getSudoku().getSettings()); cellPanel.update(colorSettings); squarePanel.add(cellPanel); } } add(squarePanel); } } setCellPanelSize(25); sudokuPuzzle.getSudoku().addSudokuListener(this); actionPerformed(null); }