void (MouseWheelEvent e) { if (!isShowing()) return; int rotation = e.getWheelRotation(); if (rotation == 0) return; if (e.getComponent() != this) { e = (MouseWheelEvent)SwingUtilities.convertMouseEvent(e.getComponent(), e, this); } Point p = e.getPoint(); SwingUtilities.convertPointToScreen(p, this); Point tPoint = getLocationOnScreen(); if (p.x >= tPoint.x && p.x <= tPoint.x + getWidth() && p.y >= tPoint.y && p.y <= tPoint.y + getHeight()) { myLayout.updateShift(rotation * 10); } }