source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java@ 1847

Last change on this file since 1847 was 1847, checked in by Gubaer, 15 years ago

replaced calls to JOptionPane.* by calls to OptionPaneUtil.*

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.gui.dialogs;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.Component;
7import java.awt.event.ActionEvent;
8
9import javax.swing.AbstractAction;
10import javax.swing.JList;
11import javax.swing.JOptionPane;
12import javax.swing.JPopupMenu;
13
14import org.openstreetmap.josm.Main;
15import org.openstreetmap.josm.gui.OptionPaneUtil;
16import org.openstreetmap.josm.gui.layer.Layer;
17import org.openstreetmap.josm.tools.ImageProvider;
18
19/**
20 * Popup menu handler for the layer list.
21 */
22public class LayerListPopup extends JPopupMenu {
23
24 public final static class InfoAction extends AbstractAction {
25 private final Layer layer;
26 public InfoAction(Layer layer) {
27 super(tr("Info"), ImageProvider.get("info"));
28 this.layer = layer;
29 }
30 public void actionPerformed(ActionEvent e) {
31 OptionPaneUtil.showMessageDialog(
32 Main.parent,
33 layer.getInfoComponent(),
34 tr("Information about layer"),
35 JOptionPane.INFORMATION_MESSAGE
36 );
37 }
38 }
39
40 public LayerListPopup(final JList layers, final Layer layer) {
41 for (Component c : layer.getMenuEntries()) {
42 add(c);
43 }
44 }
45}
Note: See TracBrowser for help on using the repository browser.