File: PopupMenuCustomizer.java

package info (click to toggle)
mac-widgets 0.10.0%2Bsvn416-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,968 kB
  • sloc: java: 9,909; makefile: 13; sh: 12
file content (29 lines) | stat: -rw-r--r-- 974 bytes parent folder | download | duplicates (5)
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);

}