java - Open new window when double-click row -
i open new window; plan modify data in last column.
status: cells editable;
trigger: double-click on select line.
i tried joptionpane whole table displayed.
tablemodel model = new defaulttablemodel (donnee, titrecolonnes) { public class getcolumnclass(int columnnames) { class returnvalue; if ((columnnames >= 0) && (columnnames < getcolumncount())){ returnvalue = getvalueat(0, columnnames).getclass(); } else { returnvalue = object.class; } return returnvalue; } }; table = new jtable (model){ public boolean iscelleditable(int row, int colonne) { return false; } }; table.addmouselistener(new mouseadapter(){ public void mouseclicked(final mouseevent e) { if((e.getclickcount()%2 == 0)) { jtable target = (jtable)e.getsource() ; final int row = target.getselectedrow(); final int colonne = target.getselectedcolumn(); string s = table.getmodel().getvalueat( table.getselectedrow(),table.getselectedcolumn()).tostring(); joptionpane.showmessagedialog(null, new jscrollpane(table)); } } });
Comments
Post a Comment