This example produces a frame. When you click the right mouse button you'll see a popup menu. 

===================================================================
import java.awt.*;
import java.awt.event.*;
public class TestPopUp extends Frame implements ActionListener
{
private PopupMenu popup=null;

public TestPopUp()
{
super("Testing Popup");

MenuItem m1 = new MenuItem("Pop");
MenuItem m2 = new MenuItem("Up");
m1.setActionCommand("Pop"); // tell the application what happened
m2.setActionCommand("Up");
m1.addActionListener(this); // tell the Item who to notify if selected
m2.addActionListener(this);

popup = new PopupMenu();
popup.add(m1);
popup.add(m2);
add(popup);
setSize(320,200);
enableEvents(java.awt.AWTEvent.MOUSE_EVENT_MASK);
show();
}

public void processMouseEvent(MouseEvent e) // manages the popping up
{
if (e.isPopupTrigger())
{
popup.show(this, e.getX(), e.getY());
}
else
{
super.processMouseEvent(e);
}
}

public void actionPerformed(ActionEvent e)
{
String my_command = e.getActionCommand();
if (my_command.equals("Pop"))
System.out.println("Pop");
if (my_command.equals("Up"))
System.out.println("Up");
}

public static void main(String args[])
{
new TestPopUp();
}
}