java - JTable choose other rows and get their data when certain cell is clicked -
i have jtable. want create event 1 cell if user clicks on it, able choose 1 or more rows table , corresponding ids saved in cell.
so in example user click on "click here choose" in row 2 , click on e.g. row 1 , row 3. cell "click here choose" should overwritten 1 , 3 afterwards:
i'm thinking of somehow creating mouseadapter event on click on cell have no real idea how it. idea how can approach this?
yes need use mouseadapter below(you have cell if "if condition become true"):
jt.addmouselistener(new java.awt.event.mouseadapter() { @override public void mouseclicked(java.awt.event.mouseevent evt) { int r = jt.rowatpoint(evt.getpoint()); int c = jt.columnatpoint(evt.getpoint()); if (r >= 0 && c >= 0) { ...... } } });
Comments
Post a Comment