0

I've loaded the OSM map in Java GUI using JMapViewer class and added a searchbox and a button. How do I search locations using string input on ButtonClick? This is what I've done so far, please tell me what I'm doing wrong or what should I do?

private final JTextField searchText;
searchText= new JTextField(20);  
JButton go=new JButton("Go!!");
        go.addActionListener(new ActionListener()
                {
                    public void actionPerformed(ActionEvent e)
                    {
                        String query=searchText.getText();




                       Coordinate p = JMapViewer.getPosition(SearchAction.search(query));
                         LayerGroup search=new LayerGroup("Search");
                        Layer searchGroup=search.addLayer("Search Layer");
                          String res= map().getName();
                        double latpos=p.getLat();
                          double lonpos=p.getLon();
                         MapMarkerDot show=new MapMarkerDot(searchGroup,query,latpos,lonpos);

                    }

            private String search(String query) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

            private String searchAction(String query) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

                });

0 Answers0