src/main/java/de/uapcore/sudoku/SudokuTextField.java

changeset 12
1c62c6009161
parent 10
369903afbb29
child 13
5e69b1bb707f
equal deleted inserted replaced
11:f7433671fec5 12:1c62c6009161
112 */ 112 */
113 public int getValue() { 113 public int getValue() {
114 if (getText().isEmpty()) { 114 if (getText().isEmpty()) {
115 return 0; 115 return 0;
116 } else { 116 } else {
117 return Integer.valueOf(getText()); 117 return Integer.parseInt(getText());
118 } 118 }
119 } 119 }
120 120
121 /** 121 /**
122 * Sets the field's value. 122 * Sets the field's value.
123 * 123 *
124 * @param v the number from 1 to 9 or zero to clear the field 124 * @param v the number from 1 to 9 or zero to clear the field
125 * @throws IllegalArgumentException if v is not between 0 and 9
125 */ 126 */
126 public void setValue(int v) { 127 public void setValue(int v) {
127 if (v == 0) { 128 if (v == 0) {
128 setText(""); 129 setText("");
129 } else if (v < 10) { 130 } else if (v < 10) {

mercurial