Heres a great article tutorial i found that helped me to accomplish what your trying to accomplish.
http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html#popup
i also found that link from this stack overflow article
How do I create a right click context menu in Java Swing?
Hope this helps