Sudoku board style
This commit is contained in:
		
							parent
							
								
									ffd1d4bd51
								
							
						
					
					
						commit
						9f25270371
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -44,6 +44,12 @@ public class SudokuView extends JFrame {
 | 
			
		|||
            for (int col = 0; col < 9; col++) {
 | 
			
		||||
                grid[row][col] = new JTextField(2);
 | 
			
		||||
                grid[row][col].setHorizontalAlignment(JTextField.CENTER);
 | 
			
		||||
    
 | 
			
		||||
                // Set background color to gray for every third JTextField
 | 
			
		||||
                if ((row / 3 + col / 3) % 2 == 1) {
 | 
			
		||||
                    grid[row][col].setBackground(Color.LIGHT_GRAY);
 | 
			
		||||
                }
 | 
			
		||||
    
 | 
			
		||||
                gridPanel.add(grid[row][col]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +57,7 @@ public class SudokuView extends JFrame {
 | 
			
		|||
        add(gridPanel, BorderLayout.CENTER);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    /** Initialize the buttons, called by the constructor */
 | 
			
		||||
    private void initializeButtons() {
 | 
			
		||||
        solveButton = new JButton("Solve");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue