package nl.elridge.sudoku.view; import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.UIManager; import nl.elridge.sudoku.controller.ButtonController; import nl.elridge.sudoku.controller.SudokuController; import nl.elridge.sudoku.model.Game; /** * Main class of program. * * @author Eric Beijer */ public class Sudoku extends JFrame { public Sudoku() { super("Sudoku"); setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); Game game = new Game(); ButtonController buttonController = new ButtonController(game); ButtonPanel buttonPanel = new ButtonPanel(); buttonPanel.setController(buttonController); add(buttonPanel, BorderLayout.EAST); SudokuPanel sudokuPanel = new SudokuPanel(); SudokuController sudokuController = new SudokuController(sudokuPanel, game); sudokuPanel.setGame(game); sudokuPanel.setController(sudokuController); add(sudokuPanel, BorderLayout.CENTER); game.addObserver(buttonPanel); game.addObserver(sudokuPanel); pack(); setLocationRelativeTo(null); setVisible(true); } /** * Main entry point of program. * * @param args Command line arguments. */ public static void main(String[] args) { // Use System Look and Feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { ex.printStackTrace(); } new Sudoku(); } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)