package sudoku; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.EventListener; import javax.swing.*; /** * The SudokuPanel class currently draws the Sudoku Board and allows for text entry. New and quit work as advertised. * * @author Kyle Wilson * @version 15 November 2006 * * code for menu bar adapted from Scribble Program example by Xiaoping Jia Copyright 2002 * */ public class SudokuPanel extends JPanel { /** * Constructs a SudokuPanel object and initializes a SudokuPanelListener to act as a MouseListener * */ public SudokuPanel() { super(); sBoard = new int[9][9]; setLayout(new GridLayout(9,9)); sudokuBoard = new SudokuTextField[9][9]; Font font = new Font("Monospace", Font.BOLD, 24); SudokuPanelListener SPListener = new SudokuPanelListener(this); for(int i=0; i 9 || testint < 1) { JOptionPane.showMessageDialog(null, "Not A Valid Entry\nSudoku Numbers must be between 1 and 9", "Alert", JOptionPane.ERROR_MESSAGE); return; } for(int i = 0; i < 9; i++) { sudokuBoard[test.x][i].duplicate = false; sudokuBoard[i][test.y].duplicate = false; for(int j = 0; j < 9; j++) { if(i != j && sBoard[test.x][i] == sBoard[test.x][j]) { sudokuBoard[test.x][i].duplicate = true; sudokuBoard[test.x][j].duplicate = true; } if(i != j && sBoard[i][test.y] == sBoard[j][test.y]) { sudokuBoard[i][test.y].duplicate = true; sudokuBoard[j][test.y].duplicate = true; } } } int myx = test.x - (test.x % 3); int myy = test.y - (test.y % 3); for(int i=myx; i