public void actionPerformed(ActionEvent e) { try { JMenuItem tmp = (JMenuItem) e.getSource(); if (tmp == sudNew) { // generateNewSud(); generateNewSud(); tmp.setEnabled(false); } else if (tmp == sudOpen) { doLoad(); } else if (tmp == sudSaveAs) { doSave(); } else if (tmp == opDiffEasy) { diff = GV.DIFF_EASY; } else if (tmp == opDiffNormal) { diff = GV.DIFF_NORMAL; } else if (tmp == opDiffHard) { diff = GV.DIFF_HARD; } else if (tmp == opDiffCustom) { doCustomDiff(); } else if (tmp == opND1) { nD = NumDistributuon.evenlyFilled3x3Cubes; } else if (tmp == opND2) { nD = NumDistributuon.evenlyDistributedNumbers; } else if (tmp == opND3) { nD = NumDistributuon.random; } else if (tmp == helpAbout) { doAbout(); } else if (tmp == sudExit) { doExit(); } else if (tmp == sudSolve) { // doSolve(); boolean b = checkIfSolved(); System.out.println(b); // if(!checkIfSolved()) if (!checkIfSolved()) { System.out.println("Inside if"); doNotSolved(); } else { doSolved(); } } else if (tmp == sudCreate) { doCreate(); } else if (tmp == sudClear) { doClear(); } } catch (ClassCastException ex) { ex.printStackTrace(); } }
public void actionPerformed(ActionEvent e) { try { JButton tmp = (JButton) e.getSource(); tmp.requestFocus(); tmp.getText(); if (lastBut != null) { lastBut.setForeground(Color.BLACK); } lastBut = tmp; lastBut.setForeground(Color.BLUE); } catch (ClassCastException ex) { ex.printStackTrace(); } }
public void update(Observable arg0, Object arg1) { try { FieldVals fv = (FieldVals) arg1; gg.getGrid().setField(fv.getY(), fv.getX(), fv.getVal()); boolean b = gg.getGrid().isGridSolved(); // ----------------------------------------------------------------------------------- // boolean b = true; /* * if(b) { sGrid.repaint(); doSolved(); } */ // ----------------------------------------------------------------------------------- } catch (ClassCastException ex) { ex.printStackTrace(); } }
public void actionPerformed(ActionEvent e) { try { JButton tmp = (JButton) e.getSource(); if (tmp == bUp[0]) { generateNewSud(); tmp.setEnabled(false); } else if (tmp == bUp[1]) { doCreate(); } else if (tmp == bUp[2]) { doLoad(); } else if (tmp == bUp[3]) { doSave(); } else if (tmp == bUp[6]) { doClear(); } else if (tmp == bUp[8]) { // doSolve(); // ----------------------------------------------- System.out.println("Button is clicked"); boolean b = checkIfSolved(); System.out.println(b); // if(!checkIfSolved()) if (!checkIfSolved()) { System.out.println("Inside if"); doNotSolved(); } else { doSolved(); } // doSolved(); // ----------------------------------------------- } else if (tmp == bUp[9]) { doExit(); } } catch (ClassCastException ex) { ex.printStackTrace(); } }