Java tutorial
//package com.java2s; /* * Copyright (c) 2011 - 2012. Elega9t Ltd. All rights reserved. * ELEGA9T PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.Copyright (c) 2011 - 2012. Elega9t Ltd. All rights reserved. */ import java.awt.*; public class Main { public static boolean isMouseOver(Component component) { return MouseInfo.getPointerInfo().getLocation().x >= component.getLocationOnScreen().x && MouseInfo.getPointerInfo().getLocation().x <= component.getLocationOnScreen().x + component.getWidth() && MouseInfo.getPointerInfo().getLocation().y >= component.getLocationOnScreen().y && MouseInfo.getPointerInfo().getLocation().y <= component.getLocationOnScreen().y + component.getHeight(); } }