List of usage examples for java.awt.event MouseEvent getID
public int getID()
From source file:MouseNavigateTest.java
protected boolean isStartBehaviorEvent(java.awt.event.MouseEvent evt) { int nId = evt.getID(); return ((nId == MouseEvent.MOUSE_DRAGGED) && (evt.isAltDown() != false) && (evt.isMetaDown() == false)); }
From source file:MouseNavigateTest.java
protected boolean isStartBehaviorEvent(java.awt.event.MouseEvent evt) { int nId = evt.getID(); return ((nId == MouseEvent.MOUSE_DRAGGED) && (evt.isAltDown() == false) && (evt.isMetaDown() != false)); }
From source file:MouseNavigateTest.java
/** * @return true if this is the event that stops drag tracking behviour the * default uses MOUSE_RELEASED./*w w w. java2 s. co m*/ */ //***************************************************************************** protected boolean isStopBehaviorEvent(java.awt.event.MouseEvent evt) { int nId = evt.getID(); return (m_bDragging != false && nId == MouseEvent.MOUSE_RELEASED || nId == MouseEvent.MOUSE_EXITED); }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
@SuppressWarnings("unused") public void mouseDragged(MouseEvent e) { if (threeButton) { if (threeBstate != s) { if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null;/*from w w w. j a v a 2 s .co m*/ threeBstate = s; } else if (threeBstate == spp) { e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } else if (threeBstate == sppr) { return; } } } int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); // button 1 -> 16 // button 2 -> 8 // button 3 -> 4 // shift -> 1 // control -> 2 // alt -> 12 ?? int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; px = x; py = y; event.mkMotionNotify(1, window.screen.rootId, /*window.id,*/ XWindow.sprite.win.id, 0, px, py, e.getX(), e.getY(), state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } event.mkMotionNotify(1, window.screen.rootId, /*window.id,*/ XWindow.sprite.win.id, 0, px, py, px - XWindow.sprite.win.x, py - XWindow.sprite.win.y, //e.getX(), //e.getY(), state, 1); if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(XWindow.sprite.win, event, XWindow.grab, null, 1); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mousePressed(MouseEvent e) { if (threeButton) { if (threeBstate == s) { threeBPressed = e;/*from w w w .j a v a 2 s. c om*/ threeBstate = sp; return; } if (threeBstate == sp // || threeBstate==sppr ) { threeBPressed = null; threeBstate = spp; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } procPressed(e); }
From source file:com.jcraft.weirdx.DDXWindowImp.java
@SuppressWarnings("unused") public void mouseDragged(MouseEvent e) { if (threeButton) { if (threeBstate != s) { if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null;// w ww .jav a 2 s . c o m threeBstate = s; } else if (threeBstate == spp) { e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } else if (threeBstate == sppr) { return; } } } if (window == null) return; // calc abs cursor position use old window position for calculation // as mouseDragged (if you use Panel) delivers its coordinates relative to the position after mousepressed // UPDATE: this was a bug of the IBM JDK // int x=e.getX()+oldwindowx; // int y=e.getY()+oldwindowy; int x = e.getX() + window.x; int y = e.getY() + window.y; // set new drag position (absolute) XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); // button 1 -> 16 // button 2 -> 8 // button 3 -> 4 // shift -> 1 // control -> 2 // alt -> 12 ?? int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; px = x; py = y; event.mkMotionNotify(1, window.screen.rootId, XWindow.sprite.win.id, 0, px, py, e.getX(), e.getY(), state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } event.mkMotionNotify(1, window.screen.rootId, XWindow.sprite.win.id, 0, px, py, px - XWindow.sprite.win.x, py - XWindow.sprite.win.y, state, 1); if (XWindow.grab != null) { XWindow.sendGrabbedEvent(event, false, 1); } else { XWindow.sendDeviceEvent(XWindow.sprite.win, event, XWindow.grab, null, 1); } } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;//from w w w . ja v a 2 s.co m threeBstate = s; return; } if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null; threeBstate = s; } else if (threeBstate == spp) { threeBPressed = null; threeBstate = sppr; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } procReleased(e); }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;// w ww .ja v a 2 s.c o m threeBstate = s; return; } if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null; threeBstate = s; } else if (threeBstate == spp) { threeBPressed = null; threeBstate = sppr; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } try { procReleased(e); } catch (Exception ee) { } }
From source file:com.projity.contrib.calendar.JXXMonthView.java
/** * {@inheritDoc}//from w w w .ja va 2 s. c om */ protected void processMouseMotionEvent(MouseEvent e) { if (e.getID() == MouseEvent.MOUSE_DRAGGED) { selectFromEvent(e); } super.processMouseMotionEvent(e); }
From source file:com.projity.contrib.calendar.JXXMonthView.java
/** * {@inheritDoc}/*from w ww .ja v a 2 s . c o m*/ */ protected void processMouseEvent(MouseEvent e) { if (e.getID() == MouseEvent.MOUSE_PRESSED) { selectFromEvent(e); } else if (e.getID() == MouseEvent.MOUSE_RELEASED) { if (_asKirkWouldSay_FIRE) { fireActionPerformed(); } _asKirkWouldSay_FIRE = false; } super.processMouseEvent(e); }