Programmatically remove maptip popup from JMap Panel

3114
3
08-12-2014 01:07 PM
JerrySchultz
New Contributor III

I have a tabbed application that has a list of items in a list to the left of the JMap. The map has maptips enabled for the map points. The user clicks on one of the points and the maptip appears as a white dialog box over the map. If the user click on a item in the list to the left of the JMap the application switches to another tab. If the maptip was enabled and the white dialog is active on the map - then when the application switches to another non-map panel the white dialog stays on the screen and cannot be removed until switching back to the map and then clicking off of the point.

I am looking for a programmatic way to remove the active maptip from the map panel before switching to the new tab. Can anyone suggest how to do such an easy thing.

0 Kudos
3 Replies
CarlosColón-Maldonado
Occasional Contributor III

You obviously have implement the MouseListener interface to override the move-entered and mouse-exited events on your InfoPopupOverlay class (I hope you have extended it or created your own to do your own implementation so you could also have it define the added interface). ex:

public void mouseEntered(MouseEvent e) {

  doSomething("Mouse entered", e);

  }

  public void mouseExited(MouseEvent e) {

  undoSomething("Mouse exited", e);

  }

If you only need to know when to remove them, use the MouseAdapter to only define the mouseExited event, instead.

Hope this helps.

0 Kudos
JerrySchultz
New Contributor III

Carlos,

Thanks for the reply. I'm using MapTip which is implemented internally by the Runtime. I've used InfoPopupOverlay in other ESRI API's but not the Java Runtime. MapTip is very simple but I can't seem to find the granularity to remove the tooltip once I click on it. Originally, I actually liked the functionality that allows the Info dialog box to stay on the map so that the user doesn't have to hold the mouse down but it is creating this nagging problem if the user moves to another tab and I haven't removed the maptip from the panel. I guess I will revert to your implied suggestion of using InfoPopupOverlay so that it is definitely removed before the user leaves the JMap.

Thanks again for the suggestion.

Jerry

0 Kudos
EliseAcheson1
Occasional Contributor

Hi Jerry,

I'm a bit confused by your post because "map tips" in the Runtime Java SDK are set to appear when the mouse hovers over a feature (for a configurable amount of time). What you describe is something that appears when a feature is clicked on, which is what the InfoPopups do - they are actual dialogs/windows so you might see the problem you describe with them staying open when not closed by the user. "Map tips" should disappear when the mouse exits the feature, and therefore also when you are outside the map (refer to the sample "Map tips" under 'Information display' in the SDK samples). Could you clarify?

~elise

0 Kudos