java - Passing mouse events from Jframe glass to menu bar? -
based on previous stack questions have written following code capture mouse input glass pane push series of panels underneath.
mousemotionlistener mml = new mousemotionlistener() { private void dispatchmouseevent(mouseevent e) { point glasspanepoint = e.getpoint(); container container = jf.getcontentpane(); point containerpoint = swingutilities.convertpoint( glass, glasspanepoint, container); if (containerpoint.y >= 0) { (component ml : mouselisteners) { point componentpoint = swingutilities .convertpoint( glass, glasspanepoint, ml); ml.dispatchevent(new mouseevent(ml, e.getid(), e.getwhen(), e.getmodifiers(), componentpoint.x, componentpoint.y, e.getclickcount(), e.ispopuptrigger())); } } } @override public void mousedragged(mouseevent me) { dispatchmouseevent(me); } @override public void mousemoved(mouseevent me) { dispatchmouseevent(me); } }; glass.addmousemotionlistener(mml); but of tutorials can find when comes menu bar.
if (containerpoint.y < 0) { //we're not in content pane if (containerpoint.y + menubar.getheight() >= 0) { //the mouse event on menu bar. //could handle specially. } else { //the mouse event on non-system window //decorations, such ones provided //the java , feel. //could handle specially. } could point me somewhere can see how handle specifically? thanks.
Comments
Post a Comment