java - How to do right click table row on netbeans? -


enter image description here

into when right click row.after clicked view profile popup , new jframe , display profile. using gui builder. sorry being noob. i'm still beginner.it's hard find on google how right click thing.

enter image description here

update2

i created menu how student id cell only... code

jmenuitem item = new jmenuitem("view profile");     jmenuitem item2 = new jmenuitem("delete");     item.addactionlistener(new actionlistener() {          @override         public void actionperformed(actionevent e) {             joptionpane.showmessagedialog(studentlist.this, "testing");         }     });     jpopupmenu1.add(item);     jpopupmenu1.add(item2); 

and on mousereleased

private void tablemousereleased(java.awt.event.mouseevent evt) {                                         int r = table.rowatpoint(evt.getpoint());     if (r >= 0 && r < table.getrowcount()) {         table.setrowselectioninterval(r, r);     } else {         table.clearselection();     }      int rowindex = table.getselectedrow();     if (rowindex < 0) {         return;     }       if (evt.ispopuptrigger() && evt.getcomponent() instanceof jtable ) {         jpopupmenu1.show(evt.getcomponent(), evt.getx(), evt.gety());     } } 

the easiest way use jcomponent#setcomponentpopupmenu

you want take @ how use menus


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -