Change cursor above button.

This commit is contained in:
Holt59 2018-03-03 15:51:03 +01:00
parent eb174d379d
commit bcfc8dac3d

View File

@ -2,6 +2,7 @@ package org.insa.graphics.drawing.components;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Point; import java.awt.Point;
@ -71,6 +72,18 @@ public class MapZoomControls {
this.minLevel = minZoom; this.minLevel = minZoom;
this.maxLevel = maxZoom; 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() { component.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {