Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import javax.swing.*;
- import java.awt.*;
- public class SudokuGUI extends JFrame {
- public SudokuGUI()
- {
- SudokuBoard sudokuBoard = new SudokuBoard();
- this.setTitle("Sudoku Board");
- JPanel panel = new JPanel();
- panel.setLayout(new GridLayout(9, 9));
- for (int i = 0; i < 9; i++) {
- for (int j = 0; j < 9; j++) {
- panel.add(sudokuBoard.grid[i][j]);
- sudokuBoard.grid[i][j].setPreferredSize(new Dimension(150, 50));
- sudokuBoard.grid[i][j].setHorizontalAlignment(JTextField.CENTER);
- }
- }
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.add(panel);
- this.pack();
- this.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment