I want to add a popup menu with the right mouse button in a JTable in NetBeans IDE (it seems like a simple task ... lol)
I got part of the job
- adding popupmenu to the form
- adding menu items to popupmenu
- go to JTable properties
- click binding tab
- set the value of ComponentPopupMenu to my popupmenu
But this only partly works. Now, when I right-click on a table, a menu appears, but the selected row in JTable does not change. Thus, when the actionPerformed menuitem element is called, I have no idea which line in JTable was clicked.
How can i get this? or is there an easier way to do this in netbeans?
I know there are other ways to do this (in code), but I would prefer to use the netbeans GUI builder.
Has anyone ever done this before?
Thanks for your help!
source share