source: josm/trunk/src/org/openstreetmap/josm/gui/widgets/ListPopupMenu.java@ 9078

Last change on this file since 9078 was 9078, checked in by Don-vip, 8 years ago

sonar - Immutable Field

  • Property svn:eol-style set to native
File size: 749 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.widgets;
3
4import javax.swing.Action;
5import javax.swing.JList;
6import javax.swing.JMenuItem;
7import javax.swing.JPopupMenu;
8import javax.swing.event.ListSelectionListener;
9
10/**
11 * @author Vincent
12 *
13 */
14public class ListPopupMenu extends JPopupMenu {
15
16 private final JList<?>[] lists;
17
18 public ListPopupMenu(JList<?> ... lists) {
19 this.lists = lists;
20 }
21
22 @Override
23 public JMenuItem add(Action a) {
24 if (lists != null && a instanceof ListSelectionListener) {
25 for (JList<?> list : lists) {
26 list.addListSelectionListener((ListSelectionListener) a);
27 }
28 }
29 return super.add(a);
30 }
31}
Note: See TracBrowser for help on using the repository browser.