ui/src/main/java/ucar/nc2/ui/gis/MapBean.java
static public PopupMenu makeMapSelectButton() {

    AbstractAction mapSelectAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        //System.out.println("mapSelectAction");
        //mapPopup.show();
      }
    };
    BAMutil.setActionProperties( mapSelectAction, "WorldMap", "select map", false, 'M', -1);
    AbstractButton mapSelectButton = BAMutil.makeButtconFromAction( mapSelectAction);

    PopupMenu mapPopup = new PopupMenu(mapSelectButton, "Select Map", true);
    return mapPopup;
  }
static public PopupMenu makeMapSelectButton() {

    AbstractAction mapSelectAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        //System.out.println("mapSelectAction");
        //mapPopup.show();
      }
    };
    BAMutil.setActionProperties( mapSelectAction, "WorldMap", "select map", false, 'M', -1);
    AbstractButton mapSelectButton = BAMutil.makeButtconFromAction( mapSelectAction);

    PopupMenu mapPopup = new PopupMenu(mapSelectButton, "Select Map", true);
    return mapPopup;
  }
static public PopupMenu makeMapSelectButton ( ) { AbstractAction mapSelectAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { //System.out.println("mapSelectAction");
 //mapPopup.show();
 } } ; BAMutil . setActionProperties ( mapSelectAction , "WorldMap" , "select map" , false , ' ' , - 1 ) ; AbstractButton mapSelectButton = BAMutil . makeButtconFromAction ( mapSelectAction ) ; PopupMenu mapPopup = new PopupMenu ( mapSelectButton , "Select Map" , true ) ; return mapPopup ; }
Convenience routine to make a button with a popup menu attached. to use:
<pre>
thredds.ui.PopupMenu mapBeanMenu = MapBean.makeMapSelectButton();
AbstractButton butt = (AbstractButton) mapBeanMenu.getParentComponent();
addToMenu (butt);

add map beans here
mapBeanMenu.addAction( mb.getActionDesc(), mb.getIcon(), mb.getAction());

mb.addPropertyChangeListener( new PropertyChangeListener() {
public void propertyChange( java.beans.PropertyChangeEvent e) {
if (e.getPropertyName().equals("Renderer")) {
mapRender = (thredds.viewer.ui.Renderer) e.getNewValue();
mapRender.setProjection( np.getProjectionImpl());
redraw();
}
}
});
Convenience routine to make a button with a popup menu attached . to use : <pre > thredds . ui . PopupMenu mapBeanMenu = MapBean . makeMapSelectButton () ; AbstractButton butt = ( AbstractButton ) mapBeanMenu . getParentComponent () ; addToMenu ( butt ) ;