JPopupMenu menu = new JPopupMenu();
addStandardContextMenu(tc, menu);
Point pt = SwingUtilities
.convertPoint(me.getComponent(), me.getPoint(), tc);
menu.show(tc, pt.x, pt.y);
}
public static void addStandardContextMenu(JTextComponent tc, JPopupMenu menu) {
if (menu.getSubElements().length > 0) {
menu.addSeparator();