1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
package com.explodingpixels.widgets;
import javax.swing.JPopupMenu;
/**
* An interface that is used to popuplate a {@link JPopupMenu}. The
* {@link #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 {@code PopupMenuCustomizer} implementation:
* <pre>
* public class MyPopupMenuCustomizer implements PopupMenuCustomizer {
* public void customizePopup(JPopupMenu popup) {
* popup.removeAll();
* JMenuItem menuItem = new JMenuItem(menuString);
* menuItem.addActionListener(someActionListener);
* popup.add(menuItem);
* }
* }
* </pre>
*/
public interface PopupMenuCustomizer {
/**
* Called just prior the given {@link JPopupMenu} being shown.
* @param popup the {@code JPopupMenu} about to be shown.
*/
void customizePopup(JPopupMenu popup);
}
|