Java Code Examples for java.awt.event.MouseEvent#MOUSE_CLICKED
The following examples show how to use
java.awt.event.MouseEvent#MOUSE_CLICKED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PermissionCellButton.java From LoboBrowser with MIT License | 6 votes |
@Override protected void processMouseEvent(final MouseEvent e) { super.processMouseEvent(e); if (e.getID() == MouseEvent.MOUSE_ENTERED) { mouseIn = true; repaint(); } else if (e.getID() == MouseEvent.MOUSE_EXITED) { mouseIn = false; repaint(); } else if (e.getID() == MouseEvent.MOUSE_CLICKED) { assert (mouseIn); if (!permissionResult.isDefault && canBeUndecidable) { cell.setPermission(PermissionSystem.Permission.Undecided); } else { if (mouseOnLeft) { cell.setPermission(PermissionSystem.Permission.Deny); } else { cell.setPermission(PermissionSystem.Permission.Allow); } } cellChangeListener.onChange(); } else { // System.out.println("Mouse event:" + e); } }
Example 2
Source File: ClickSensitivityControl.java From pumpernickel with MIT License | 6 votes |
@Override public void eventDispatched(AWTEvent e) { MouseEvent m = (MouseEvent) e; if (m.getID() == MouseEvent.MOUSE_CLICKED) { mouseClicked(m); } else if (m.getID() == MouseEvent.MOUSE_DRAGGED) { mouseDragged(m); } else if (m.getID() == MouseEvent.MOUSE_ENTERED) { mouseEntered(m); } else if (m.getID() == MouseEvent.MOUSE_EXITED) { mouseExited(m); } else if (m.getID() == MouseEvent.MOUSE_MOVED) { mouseMoved(m); } else if (m.getID() == MouseEvent.MOUSE_PRESSED) { mousePressed(m); } else if (m.getID() == MouseEvent.MOUSE_RELEASED) { mouseReleased(m); } }
Example 3
Source File: ClueScrollPlugin.java From 07kit with GNU General Public License v3.0 | 6 votes |
@EventHandler public void handleLocateOnMapClick(MouseEvent event) { if (locateOnMapBounds != null && locateOnMapBounds.contains(event.getX() - getPosition().getX(), event.getY() - getPosition().getY())) { if (event.getID() == MouseEvent.MOUSE_PRESSED) { clicking = true; event.consume(); } else if (event.getID() == MouseEvent.MOUSE_CLICKED) { if (currentMarker != null) { currentMarker.moveTo(); } else { NotificationsUtil.showNotification("Clue Scroll", "No map marker found"); } event.consume(); } else { hovered = true; clicking = false; event.consume(); } } else { clicking = false; hovered = false; } }
Example 4
Source File: NpcKillCounterOverlayPlugin.java From 07kit with GNU General Public License v3.0 | 6 votes |
@EventHandler public void handleReset(MouseEvent event) { if (resetBounds != null && resetBounds.contains(event.getX() - getPosition().getX(), event.getY() - getPosition().getY())) { if (event.getID() == MouseEvent.MOUSE_PRESSED) { clicking = true; event.consume(); } else if (event.getID() == MouseEvent.MOUSE_CLICKED) { resetKills(); event.consume(); } else { hovered = true; clicking = false; event.consume(); } } else { clicking = false; hovered = false; } }
Example 5
Source File: PicMap.java From megamek with GNU General Public License v2.0 | 6 votes |
@Override protected void processMouseEvent(MouseEvent e) { PMHotArea ha = getAreaUnder(e.getX(), e.getY()); switch (e.getID()) { case MouseEvent.MOUSE_CLICKED: if (ha != null) ha.onMouseClick(e); break; case MouseEvent.MOUSE_PRESSED: if (ha != null) ha.onMouseDown(e); break; case MouseEvent.MOUSE_RELEASED: if (ha != null) ha.onMouseUp(e); break; } update(); }
Example 6
Source File: IdeGlassPaneImpl.java From consulo with Apache License 2.0 | 6 votes |
private static void fireMouseEvent(final MouseListener listener, final MouseEvent event) { switch (event.getID()) { case MouseEvent.MOUSE_PRESSED: listener.mousePressed(event); break; case MouseEvent.MOUSE_RELEASED: listener.mouseReleased(event); break; case MouseEvent.MOUSE_ENTERED: listener.mouseEntered(event); break; case MouseEvent.MOUSE_EXITED: listener.mouseExited(event); break; case MouseEvent.MOUSE_CLICKED: listener.mouseClicked(event); break; } }
Example 7
Source File: XToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static boolean isRightMouseButton(MouseEvent me) { int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) || (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3)); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) || (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)); } return false; }
Example 8
Source File: XToolkit.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static boolean isRightMouseButton(MouseEvent me) { int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) || (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3)); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) || (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)); } return false; }
Example 9
Source File: PopupUtil.java From netbeans with Apache License 2.0 | 6 votes |
public void eventDispatched(java.awt.AWTEvent aWTEvent) { if (aWTEvent instanceof MouseEvent) { MouseEvent mv = (MouseEvent)aWTEvent; if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) { //#118828 if (! (aWTEvent.getSource() instanceof Component)) { hidePopup(); return; } Component comp = (Component)aWTEvent.getSource(); Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp); // if (par == null && barpar == null) { if ( par == null ) { hidePopup(); } } } }
Example 10
Source File: XToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static boolean isRightMouseButton(MouseEvent me) { int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) || (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3)); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) || (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)); } return false; }
Example 11
Source File: XToolkit.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 12
Source File: XToolkit.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 13
Source File: Outline.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void processMouseEvent(MouseEvent e) { switch(e.getID()) { case MouseEvent.MOUSE_PRESSED: selectionDisabled = false; break; case MouseEvent.MOUSE_RELEASED: selectionDisabled = false; break; case MouseEvent.MOUSE_CLICKED: selectionDisabled = false; break; case MouseEvent.MOUSE_ENTERED: selectionDisabled = false; break; case MouseEvent.MOUSE_EXITED: selectionDisabled = false; break; case MouseEvent.MOUSE_MOVED: break; case MouseEvent.MOUSE_DRAGGED: if (selectionDisabled) { //System.err.println("\nDrag DISABLED."); return ; } break; case MouseEvent.MOUSE_WHEEL: break; } super.processMouseEvent(e); }
Example 14
Source File: XToolkit.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 15
Source File: OnePixelDivider.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void processMouseEvent(MouseEvent e) { super.processMouseEvent(e); if (e.getID() == MouseEvent.MOUSE_CLICKED) { if (mySwitchOrientationEnabled && e.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(e) && (SystemInfo.isMac ? e.isMetaDown() : e.isControlDown())) { mySplitter.setOrientation(!mySplitter.getOrientation()); } if (myResizeEnabled && e.getClickCount() == 2) { mySplitter.setProportion(.5f); } } }
Example 16
Source File: bug6690791.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { MouseEvent me = new MouseEvent(new JLabel(), MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), MouseEvent.ALT_MASK, 10, 10, 100, 100, 1, false, MouseEvent.BUTTON1); me.setSource(new Object()); MenuSelectionManager.defaultManager().processMouseEvent(me); }
Example 17
Source File: bug6690791.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { MouseEvent me = new MouseEvent(new JLabel(), MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), MouseEvent.ALT_MASK, 10, 10, 100, 100, 1, false, MouseEvent.BUTTON1); me.setSource(new Object()); MenuSelectionManager.defaultManager().processMouseEvent(me); }
Example 18
Source File: XToolkit.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 19
Source File: TimeUI.java From whyline with MIT License | 4 votes |
public boolean ioEventIsOfDesiredType(IOEvent io) { if(selection == null) return true; if(io instanceof MouseStateInputEvent) { MouseStateInputEvent mouseEvent = (MouseStateInputEvent)io; int id = mouseEvent.getType(); switch(id) { case MouseEvent.MOUSE_PRESSED : return selection == press; case MouseEvent.MOUSE_DRAGGED : return selection == drag; case MouseEvent.MOUSE_CLICKED : case MouseEvent.MOUSE_RELEASED : return selection == release; case MouseEvent.MOUSE_WHEEL : return selection == scroll; case MouseEvent.MOUSE_MOVED : return selection == move; default : return false; } } else if(io instanceof KeyStateInputEvent) { KeyStateInputEvent keyEvent = (KeyStateInputEvent)io; int type = keyEvent.getType(); switch(type) { case KeyEvent.KEY_PRESSED : return selection == keydown; case KeyEvent.KEY_RELEASED : return selection == keyup; case KeyEvent.KEY_TYPED : return selection == keyup; default: return false; } } else if(selection == repaint) return io instanceof GetGraphicsOutputEvent; else if(selection == print) return io instanceof TextualOutputEvent; else return false; }
Example 20
Source File: EditorScrollPane.java From nextreports-designer with Apache License 2.0 | 3 votes |
/** * This method is overridden so that if the user clicks in the line * number border, the caret is moved.<p> * * This method will ONLY work if LineNumberBorder is used * (not LineNumberList). * * @param event The mouse event. */ public void processMouseEvent(MouseEvent event) { if (event.getID() == MouseEvent.MOUSE_CLICKED) { int y = getViewport().getViewPosition().y + event.getY(); int pos = editorPane.viewToModel(new Point(0, y)); editorPane.setCaretPosition(pos); } super.processMouseEvent(event); }