src/de/uapcore/sudoku/Field.java

changeset 2
5179eff8a9b6
parent 1
f1d7de36b01e
child 3
ed931970b4ac
     1.1 --- a/src/de/uapcore/sudoku/Field.java	Sat Jan 26 15:48:59 2013 +0100
     1.2 +++ b/src/de/uapcore/sudoku/Field.java	Sat Jan 26 17:42:07 2013 +0100
     1.3 @@ -13,7 +13,7 @@
     1.4   *
     1.5   * @author mike
     1.6   */
     1.7 -public class Field extends JPanel {
     1.8 +public final class Field extends JPanel {
     1.9      private SudokuTextField[][] cells;
    1.10      
    1.11      public Field() {
    1.12 @@ -66,5 +66,30 @@
    1.13          graphics.drawImage(img, 0, 0, this);
    1.14      }
    1.15      
    1.16 +    public int getCellValue(int x, int y) {
    1.17 +        return cells[x][y].getValue();
    1.18 +    }
    1.19      
    1.20 +    public void setCellValue(int x, int y, int v) {
    1.21 +        cells[x][y].setValue(v);
    1.22 +    }
    1.23 +    
    1.24 +    public void setAllCellsModified(boolean modified) {
    1.25 +        for (int x = 0 ; x < 9 ; x++) {
    1.26 +            for (int y = 0 ; y < 9 ; y++) {
    1.27 +                cells[x][y].setModified(modified);
    1.28 +            }
    1.29 +        }
    1.30 +    }
    1.31 +    
    1.32 +    public boolean isAnyCellModified() {
    1.33 +        for (int x = 0 ; x < 9 ; x++) {
    1.34 +            for (int y = 0 ; y < 9 ; y++) {
    1.35 +                if (cells[x][y].isModified()) {
    1.36 +                    return true;
    1.37 +                }
    1.38 +            }
    1.39 +        }
    1.40 +        return false;
    1.41 +    }
    1.42  }

mercurial