List of usage examples for java.awt.event InputEvent BUTTON1_MASK
int BUTTON1_MASK
To view the source code for java.awt.event InputEvent BUTTON1_MASK.
Click Source Link
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mousePressed(MouseEvent e) { if (threeButton) { if (threeBstate == s) { threeBPressed = e;/*from w ww. j a v a 2 s .c o m*/ 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.DDXWindowImpSwing.java
private void procPressed(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;/*from w ww.j av a 2 s . co m*/ XWindow.sprite.hot.y = y; int mod = e.getModifiers(); if (mod == 0) { mod |= InputEvent.BUTTON1_MASK; } // ????? int state = 0; int detail = 1; if ((mod & InputEvent.BUTTON1_MASK) != 0) detail = 1; if ((mod & InputEvent.BUTTON2_MASK) != 0) detail = 2; if ((mod & InputEvent.BUTTON3_MASK) != 0) detail = 3; if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Event.filters[Event.MotionNotify] = Event.PointerMotionMask | Event.ButtonMotionMask | ((Event.Button1Mask >> 1) << detail); event.mkButtonPress(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab == null) { if (XWindow.checkDeviceGrabs(event, 0, 1)) { return; } } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); } // if((mod & InputEvent.SHIFT_MASK)!=0) state|=1; // if((mod & InputEvent.CTRL_MASK)!=0) state|=4; // alt -> state|=8; XWindow.sprite.hot.state = state; }
From source file:nubisave.component.graph.splitteradaption.NubisaveEditor.java
protected PluggableGraphMouse createPluggableGraphMouse(RenderContext<NubiSaveVertex, NubiSaveEdge> rc, Factory<AbstractNubisaveComponent> vertexFactory, Factory<? extends NubiSaveEdge> edgeFactory, DataVertexEdgeFactory dataVertexEdgeFactory) { PluggableGraphMouse graphMouse = new PluggableGraphMouse(); VertexPicker<NubiSaveVertex, NubiSaveEdge> pickingPlugin = new VertexPicker<NubiSaveVertex, NubiSaveEdge>(); TranslatingGraphMousePlugin translatingPlugin = new TranslatingGraphMousePlugin(InputEvent.BUTTON1_MASK); ScalingGraphMousePlugin scalingPlugin = new ScalingGraphMousePlugin(new ViewScalingControl(), 0, 1.1f, 1 / 1.1f);/*from w ww. j ava 2 s. c om*/ PopupEditor popupEditingPlugin = new PopupEditor(edgeFactory); StorageServicePicker<NubiSaveVertex, NubiSaveEdge> storageServicePickingPlugin = new StorageServicePicker<NubiSaveVertex, NubiSaveEdge>(); ExtensibleNubisaveComponentMousePlugin extendablePlugin = new ExtensibleNubisaveComponentMousePlugin( vertexFactory, edgeFactory); extendablePlugin.addEventListener(new AbstractNubiSaveComponentCreator(vv, graph, vertexFactory)); extendablePlugin.addEventListener(new ToggleActivateNubisaveComponentOnDoubleClick(vv, graph)); extendablePlugin.addEventListener(new PreventEdgeCreationForRestrictedPorts(vv, graph)); extendablePlugin.addEventListener(new DataVertexEdgeCreator(vv, graph, dataVertexEdgeFactory)); extendablePlugin.addEventListener(new AbstractNubisaveComponentEdgeCreator(vv, graph, (WeightedNubisaveVertexEdgeFactory) edgeFactory)); graphMouse.add(scalingPlugin); graphMouse.add(extendablePlugin); graphMouse.add(storageServicePickingPlugin); graphMouse.add(translatingPlugin); graphMouse.add(popupEditingPlugin); return graphMouse; }
From source file:com.jcraft.weirdx.DDXWindowImp.java
private void procPressed(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; oldWindowx = window.x;/* w ww .jav a2s . co m*/ oldWindowy = window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); if (mod == 0) { mod |= InputEvent.BUTTON1_MASK; } // ????? int state = 0; int detail = 1; if ((mod & InputEvent.BUTTON1_MASK) != 0) detail = 1; if ((mod & InputEvent.BUTTON2_MASK) != 0) detail = 2; if ((mod & InputEvent.BUTTON3_MASK) != 0) detail = 3; if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Event.filters[Event.MotionNotify] = Event.PointerMotionMask | Event.ButtonMotionMask | ((Event.Button1Mask >> 1) << detail); event.mkButtonPress(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab == null) { if (XWindow.checkDeviceGrabs(event, 0, 1)) { return; } } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); } // if((mod & InputEvent.SHIFT_MASK)!=0) state|=1; // if((mod & InputEvent.CTRL_MASK)!=0) state|=4; // alt -> state|=8; XWindow.sprite.hot.state = state; }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;//from w ww . j a va 2s .com 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;//from ww 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()); } } try { procReleased(e); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
private void procReleased(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;//from w ww. ja va 2s.c o m XWindow.sprite.hot.y = y; int mod = e.getModifiers(); 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 = 0; // ????? Event.filters[Event.MotionNotify] = Event.PointerMotionMask/*| ((Event.Button1Mask>>1)<<detail)*/; event.mkButtonRelease(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, true, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } XWindow.grab = null; }
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 va 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; } } } 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
@SuppressWarnings("unused") public void mouseDragged(MouseEvent e) { if (threeButton) { if (threeBstate != s) { if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null;/*w ww . j av a 2 s . c om*/ 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.DDXWindowImp.java
public void mouseMoved(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;/*from w w w . ja v a 2s . co m*/ XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; px = x; py = y; if ((mod & InputEvent.BUTTON1_MASK) != 0) state |= (1 << 8); if ((mod & InputEvent.BUTTON2_MASK) != 0) state |= (1 << 9); if ((mod & InputEvent.BUTTON3_MASK) != 0) state |= (1 << 10); if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; event.mkMotionNotify(0, window.screen.rootId, window.id, 0, x, y, x - window.x, y - window.y, state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } }