示例#1
0
  private void generateNewSud() {

    System.out.println("Inside generate sudoku");
    // ObjectInputStream ois = null;

    /*
     * switch(diff) { case GV.DIFF_EASY : jTextDiff.setText("Easy"); break;
     * case GV.DIFF_NORMAL : jTextDiff.setText("Normal"); break; case
     * GV.DIFF_HARD : jTextDiff.setText("Hard"); break; default :
     * jTextDiff.setText("Custom"); }
     */
    /*
     * try { System.out.println("Before new object stream");
     *
     * ois = new ObjectInputStream(socket.getInputStream());
     *
     * System.out.println("Before read object");
     *
     * gg = (GridGenerator) ois.readObject();
     * System.out.println("After read object");
     *
     * // gg.getGrid().resetGrid(); // gg.generate(diff, nD); //gg= }
     * catch(IOException e) { System.out.println("IO Exception");
     *
     * } catch (ClassNotFoundException e) {
     * System.out.println("Class not found Exception"); }
     */
    sinchronizeGrids();
    sGrid.repaint();
  }
示例#2
0
 private void doSolve() {
   try {
     gg.solve();
     sinchronizeGrids();
     setGridToFinished();
     sGrid.repaint();
   } catch (NullPointerException e) {
     e.printStackTrace();
     JOptionPane.showMessageDialog(
         this, "Sudoku seems to be solved.", "Solved", JOptionPane.INFORMATION_MESSAGE);
   }
 }
示例#3
0
 private void doLoad() {
   if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
     try {
       SerGrid sg = LoadSaver.load(fc.getSelectedFile().getAbsolutePath());
       sGrid.setSerGrid(sg, gg.getGrid());
     } catch (Exception e) {
       e.printStackTrace();
       JOptionPane.showMessageDialog(
           this, "Sudoku game have not been saved!", "Error", JOptionPane.ERROR_MESSAGE);
     }
   }
   sGrid.repaint();
 }
示例#4
0
  // ----------------------------------------------------------------------------------
  private void doOtherPersonWon() {
    JOptionPane.showMessageDialog(
        this, "Somebody else won!! :)", "Oops", JOptionPane.INFORMATION_MESSAGE);
    setGridToFinished();
    sGrid.repaint();

    // --------------------------------

    /*
     * //Send data over socket String text = "ClientWon"; out.println(text);
     * // textField.setText(new String(""));
     */
    // ----------------------------------
  }
示例#5
0
  // ----------------------------------------------------------------------------------
  private void doNotSolved() {
    JOptionPane.showMessageDialog(
        this, "Sudoku not solved :)", "Damn", JOptionPane.INFORMATION_MESSAGE);
    setGridToFinished();
    sGrid.repaint();

    // --------------------------------

    /*
     * //Send data over socket String text = "ClientWon"; out.println(text);
     * // textField.setText(new String(""));
     */
    // ----------------------------------
  }
示例#6
0
 private void doClear() {
   gg.getGrid().clearNoDefaultFields();
   sinchronizeGrids();
   sGrid.repaint();
 }
示例#7
0
 private void doCreate() {
   gg.getGrid().resetGrid();
   sinchronizeGrids();
   sGrid.repaint();
 }