package nr.tms.ymat.tmat; import com.bbn.openmap.LatLonPoint; import com.bbn.openmap.Layer; import com.bbn.openmap.LayerHandler; import com.bbn.openmap.MapBean; import com.bbn.openmap.gui.*; import com.bbn.openmap.layer.shape.ShapeLayer; import com.bbn.openmap.BufferedMapBean; import com.bbn.openmap.util.Debug; import javax.swing.*; import nr.widgets.basic.*; import nr.widgets.button.*; import java.awt.*; import java.util.Properties; public class tmatdsbl extends Form { public Gui gui; public tmatdsbl() { common(); } private void common() { setSize(800, 600); gui = new Gui(this); } class Gui extends nr.util.Gui { // visible fields trSearch trSB; OpenMap map; public Gui(Form form) { super(form); } protected void common() { trSB = new trSearch(); trSB.setLocation(getFirstLocation()); trSB.setSize(790, 40); trSB.setFormDefault(true); add(trSB); map = new OpenMap(); map.setLocation(trSB.getX(), trSB.getNextY()); map.setSize(700, 590); map.setVisible(true); add(map); } // end common class trSearch extends SearchBox { public trSearch() { } public boolean preButtonAction() { refreshMap(); return false; } } // end trSearch public void refreshMap() { //When I add it here is does not display Layer layer = new RouteLayer(); layer.setName("DOES NOT DISPLAY"); layer.setVisible(true); gui.map.layerHandler.addLayer(layer,0); gui.map.setVisible(true); } }// end Gui public class OpenMap extends ExtendedPanel { public LayerHandler layerHandler; public OpenMap() { super(); this.setLayout(new BorderLayout()); MapBean mapBean = new BufferedMapBean(); mapBean.setCenter(new LatLonPoint(-28.5f, 134.0f)); mapBean.setScale(30000000f); this.add(mapBean,BorderLayout.CENTER); layerHandler = new LayerHandler(); layerHandler.addLayerListener(mapBean); //When I add it here is displays Layer layer = new RouteLayer(); layer.setName("DISPLAYS"); layer.setVisible(true); layerHandler.addLayer(layer,0); LayersPanel layerspanel = new LayersPanel(layerHandler); // Create the directional and zoom control tool OMToolSet omts = new OMToolSet(); omts.setupListeners(mapBean); omts.addButton("layers.gif", "Layer Controls",layerspanel.getActionListener()); // Create an OpenMap toolbar ToolPanel toolBar = new ToolPanel(); toolBar.add("omts", omts); toolBar.setOrientation(JToolBar.VERTICAL); this.add(toolBar, BorderLayout.WEST); } //end OpenMap constructor } //OpenMap } // end tmatdsbl