java - How to know if MouseWheelListener can receive events? -
there 1 jpanel
attached mousewheellistener
. panel has on top several other jpanels, , occupies parent jpanel
area. want know if mousewheellistener
can receive events when mouse on parent jpanel
. if attach mouselistener
parent jpanel
- not receiving events, because on top of there several other jpanels.
maybe there method find out when mousewheellistener
can receive events? mean if standing on jscrollpane
- can move scrollbar (and not important how many jpanels on it).
edit:
the awteventlistener
didn't helped - upper jpanels still blocking parent jpanel events.. :
awteventlistener awt = new awteventlistener() { @override public void eventdispatched(awtevent e) { if (mouseevent.mouse_entered == e.getid()) { mouseevent event = (mouseevent) e; (component c : getcomponents()) {//get parent jpanel components if (event.getcomponent().equals(c)) { active = true; scrollbar.repaint(); break; } } } else if (mouseevent.mouse_exited == e.getid()) { mouseevent event = (mouseevent) e; (component c : getcomponents()) { if (event.getcomponent().equals(c)) { active = false; scrollbar.repaint(); break; } } } } }; toolkit.getdefaulttoolkit().addawteventlistener(awt, awtevent.mouse_event_mask);
perhaps impossible achieve that..
Comments
Post a Comment