exception - JTable : java.lang.ArrayIndexOutOfBoundsException: -1 -


i trying value of row of jtable in java, rows' values database:

table.getselectionmodel().addlistselectionlistener(new listselectionlistener()                    {                     public void valuechanged(listselectionevent event)                          {                      //etime.settext(table.getvalueat(table.getselectedrow(), 0).tostring());                    // ename.settext(table.getvalueat(table.getselectedrow(), 1).tostring());                    // evalue.settext(table.getvalueat(table.getselectedrow(), 2).tostring());                    // cname.settext(table.getvalueat(table.getselectedrow(), 3).tostring());                    // cmodel.settext(table.getvalueat(table.getselectedrow(), 4).tostring());                             try{                    system.out.println(table.getvalueat(table.getselectedrow(), 3).tostring());                             }catch(exception g)                     { system.out.println(g);                      }}                     }); 

when press on row of table following exception: java.lang.arrayindexoutofboundsexception: -1

what doing wrong here?


Comments