From bcfc8dac3da1862a06431667569ae202f7960e48 Mon Sep 17 00:00:00 2001 From: Holt59 Date: Sat, 3 Mar 2018 15:51:03 +0100 Subject: [PATCH] Change cursor above button. --- .../drawing/components/MapZoomControls.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/org/insa/graphics/drawing/components/MapZoomControls.java b/src/main/org/insa/graphics/drawing/components/MapZoomControls.java index ec3e2b9..d6fd2a8 100644 --- a/src/main/org/insa/graphics/drawing/components/MapZoomControls.java +++ b/src/main/org/insa/graphics/drawing/components/MapZoomControls.java @@ -2,6 +2,7 @@ package org.insa.graphics.drawing.components; import java.awt.Color; import java.awt.Component; +import java.awt.Cursor; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; @@ -71,6 +72,18 @@ public class MapZoomControls { this.minLevel = minZoom; this.maxLevel = maxZoom; + component.addMouseMotionListener(new MouseAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + if (zoomInRect.contains(e.getPoint()) || zoomOutRect.contains(e.getPoint())) { + component.setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + else { + component.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + } + }); + component.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) {