java - No error yet no output. Help.(Sudoku solver getter) -
i want add text fields a01, a02, ...
array a
. want display value of val
know if text being taken text fields. code not show errors, but, well, doesn't give me output well.
int i, j; jtextfield[][] = new jtextfield[9][9]; int[][] val = new int[9][9]; (i = 0; < 9; i++) { (j = 0; j < 9; j++) { val[i][j] = integer.parseint(a[i][j].gettext()); system.out.println(val[i][j]); } }
it old question here.
you did not give them value
int i,j; // counter jtextfield[][] = new jtextfield[9][9]; for(i=0;i<9;i++) { for(j=0;j<9;j++) { jtextfield tf = new jtextfield(); tf.settext("a"+i+j); a[i][j] = tf; } }
in version call a[i][j].gettext()
should throw nullpointerexception. should either kill application, end on console or have somewhere
try { // more code here } catch (exception ex){}
which silently swallow exception , veeeeery bad practice.
Comments
Post a Comment