FileDocCategorySizeDatePackage
PopupTest.javaAPI DocExample1574Mon Mar 24 01:57:46 GMT 1997None

PopupTest

public class PopupTest extends Applet implements ActionListener

Fields Summary
PopupMenu
popup
Constructors Summary
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

        System.out.println (e);
    
public voidinit()

	    
        MenuItem mi;
        popup = new PopupMenu("Title Goes Here");
        popup.add(mi = new MenuItem ("Undo"));
        mi.addActionListener (this);
        popup.addSeparator();
        popup.add(mi = new MenuItem("Cut")).setEnabled(false);
        mi.addActionListener (this);
        popup.add(mi = new MenuItem("Copy")).setEnabled(false);
        mi.addActionListener (this);
        popup.add(mi = new MenuItem ("Paste"));
        mi.addActionListener (this);
        popup.add(mi = new MenuItem("Delete")).setEnabled(false);
        mi.addActionListener (this);
        popup.addSeparator();
        popup.add(mi = new MenuItem ("Select All"));
        mi.addActionListener (this);
	  add (popup);
	  resize(200, 200);
        enableEvents (AWTEvent.MOUSE_EVENT_MASK);
    
protected voidprocessMouseEvent(java.awt.event.MouseEvent e)

        if (e.isPopupTrigger())
            popup.show(e.getComponent(), e.getX(), e.getY());
        super.processMouseEvent (e);