src/de/uapcore/sudoku/ActionHandler.java

changeset 7
2c0a2766461c
parent 6
5bab2e971333
equal deleted inserted replaced
6:5bab2e971333 7:2c0a2766461c
132 "Sudoku", JOptionPane.WARNING_MESSAGE); 132 "Sudoku", JOptionPane.WARNING_MESSAGE);
133 } 133 }
134 } 134 }
135 135
136 private void solve() { 136 private void solve() {
137 // TODO: solve 137 if (!solver.check(field) || !solver.solve(field)) {
138 JOptionPane.showMessageDialog(field, "Das Feld ist nicht lösbar!",
139 "Sudoku", JOptionPane.WARNING_MESSAGE);
140 }
138 } 141 }
139 142
140 private boolean saveUnsaved() { 143 private boolean saveUnsaved() {
141 boolean proceed = false; 144 boolean proceed = false;
142 if (field.isAnyCellModified()) { 145 if (field.isAnyCellModified()) {
160 @Override 163 @Override
161 public void actionPerformed(ActionEvent e) { 164 public void actionPerformed(ActionEvent e) {
162 switch (e.getActionCommand()) { 165 switch (e.getActionCommand()) {
163 case NEW: 166 case NEW:
164 if (saveUnsaved()) { 167 if (saveUnsaved()) {
168 doc.clearFilename();
165 field.clear(); 169 field.clear();
166 } 170 }
167 break; 171 break;
168 case OPEN: 172 case OPEN:
169 open(); 173 open();

mercurial