void (ActionEvent e) { if (!myTarget.isShowing()) return; PointerInfo info = MouseInfo.getPointerInfo(); if (info == null) return; Point mouseLocation = info.getLocation(); Point targetLocation = myTarget.getLocationOnScreen(); if (mouseLocation.x < targetLocation.x || mouseLocation.x > targetLocation.x + myTarget.getWidth()) { return; } if (Math.abs(mouseLocation.y - targetLocation.y - getMaxHeight()) < 10) { myScrollDirection = 1; } else if (Math.abs(mouseLocation.y - targetLocation.y) < 10) { myScrollDirection = -1; } else { return; } SwingUtilities.convertPointFromScreen(mouseLocation, myTarget); myTarget.dispatchEvent( new MouseEvent(myTarget, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), 0, mouseLocation.x, mouseLocation.y, 0, false)); updateShift(5 * myScrollDirection); }