This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hello...! i have a problem and i could not able to overcome it. I have two JPanels- one where some JLabels are placed and in another open street map is placed. Now i need to perform mouse listener for the JLables. If i clicked a JLabel then it must take me to that particular location of open street map. i am trying for more than a week but still cannot able to find any solution. please give me some suggestion.i have found one link but it does not work for me.....
I have used seperate classes. i returned the JPanel(mapContainer) and used in another JPanel(panel) class which contains a JPanel(labelPanel) with JLabels, using GridBagLayout. Now i need to use mouse listener from labelPanel, but i could not able to do it. please guide me......
Sir, i don't know the proper code thats why i have not shown previously. Here it is.....
i tried the code.
Now i found the error in getInstance method giving errors---
Bound mismatch: The generic method getInstance(Class<T>) of type Application is not applicable for the arguments (Class<MapPanel>). The inferred type MapPanel is not a valid substitute for the bounded parameter <T extends Application>
and also in getContext() giving errors---
The method getContext() is undefined for the type MapPanel
Now i don't know how to do. please guide me as i don't know much about it. the second error i know that it is due to not defining the method getContext() in MapPanel. But i don't know what to put in that method.......... please show me a way. i am completely lost and cannot find any way to come out. please help me..... as i left only 10days to complete my work. i am searching in google but in vain. still trying.
You are using MapPanel.class as the argument to the Application.getInstance() method. The Application.getInstance() requires an argument of type Class<T extends Application>.
You you would need to call Application.getInstance(X.class), where X is Application or a subclass thereof. I don't know which are valid, because I don't have the API here. This should solve both your errors.
As for your JLabels, I don't know what problems you are experiencing, so I can't help you until you describe what it is you're getting stuck on. You know how to use MouseListeners, right?
Solving the first error will fix the second one as well.
The first error message is quite clear. The generic type is bound to be Application or a subtype of it. You are now providing MapPanel.class which obviously does not extend Application. Change MapPanel.class to your Application subclass's Class object.
Sorry to say that but i could not able to use mouse listener for open street map. i tried a lot. If possible please give me an example explaining this.......... i cannot find any way.... if you can please come forward and take me to the right track..... please guide me......please....