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(); }
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); } }
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(); }
// ---------------------------------------------------------------------------------- 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("")); */ // ---------------------------------- }
// ---------------------------------------------------------------------------------- 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("")); */ // ---------------------------------- }
private void doClear() { gg.getGrid().clearNoDefaultFields(); sinchronizeGrids(); sGrid.repaint(); }
private void doCreate() { gg.getGrid().resetGrid(); sinchronizeGrids(); sGrid.repaint(); }