Marker mouseover state in JxMaps

211 Views Asked by At

Is there a way to add mouseover state to a marker in Google Maps embedded in Java app via JxMaps? I was looking for a way to show whether the marker is clickable or not on hover. However, I didn’t find a suitable method that sets this icon the API

1

There are 1 best solutions below

0
Vitaly Eremenko On BEST ANSWER

To implement functionality like this, you have to attach to marker mouse events and change marker icon (using Marker.setIcon method) depending on mouse position.

marker.addEventListener("mouseover", new MapEvent() {
   @Override
   public void onEvent() {
      marker.setIcon(hoverIcon);
   }
}});

marker.addEventListener("mouseout", new MapEvent() {
   @Override
   public void onEvent() {
      marker.setIcon(normalIcon);
   }
}});