Tuesday, May 8, 2012

map in a JFrame using url

I'm trying to add a google-map in my frame, I read here that the best way is opening an URL, so, I did:



    JTextPane myMap = new JTextPane();
JScrollPane scroll = new JScrollPane();
scroll.getViewport().add(myMap);


scroll.setBounds(40,240,1200,644);
background.add(scroll);

try{
URL url = getClass().getResource("/html/maps.html");

myMap.setPage(url);
} catch (Exception e) {
e.printStackTrace();
}


But I see nothing, if I use helloWorld.html instead of maps.htm I see the content.



Why is it happening?



Thank you in advance





No comments:

Post a Comment