Interface PopupMenuCustomizer

All Known Implementing Classes:
PopupMenuCustomizerUsingStrings

public interface PopupMenuCustomizer
An interface that is used to popuplate a JPopupMenu. The customizePopup(JPopupMenu) method will be called just prior to each showing of the menu. Thus, the implementor should clear the menu at the beginning of the customization. Here is a simple PopupMenuCustomizer implementation:
 public class MyPopupMenuCustomizer implements PopupMenuCustomizer {
     public void customizePopup(JPopupMenu popup) {
           popup.removeAll();
           JMenuItem menuItem = new JMenuItem(menuString);
           menuItem.addActionListener(someActionListener);
           popup.add(menuItem);
     }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called just prior the given JPopupMenu being shown.
  • Method Details

    • customizePopup

      void customizePopup(JPopupMenu popup)
      Called just prior the given JPopupMenu being shown.
      Parameters:
      popup - the JPopupMenu about to be shown.