Documentation

Trace: Using Popup Menus

(jvx:client:gui)

Using Popup Menus

If you need a popup menu for your table on right mouse click, simple add it. A short example:

UIMenu menActions = new UIMenu("Actions");
 
UIMenuItem miInsert = new UIMenuItem("Insert");
UIMenuItem miDelete = new UIMenuItem("Delete");
 
menActions.add(miInsert);
menActions.add(miDelete);               
 
UIMenuItem  miSearch = new UIMenuItem("Show");
miSearch.setImage(UIImage.getImage(UIImage.SEARCH_SMALL));
 
UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.add(menActions);
popupMenu.addSeparator();
popupMenu.add(miSearch);

You should add a mouse event for your component to show the popup (you also could add the event to an image or a panel):

tblMaster.eventMousePressed().addListener(this, "doShowPopup");

and the listener method:

public void doShowPopup(UIMouseEvent pEvent)
{
    if (pEvent.isPopupTrigger() )
    {   
        popupMenu.show(pEvent.getSource(), pEvent.getX(), pEvent.getY());
    }
}
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information