Libraryless. Click here for Pure Java version (9186L/51K).
sbool mouseEventIsInBorder(MouseEvent e) swing { var c = optCast JComponent(e.getComponent()); if (c == null) false; var border = c.getBorder(); if (border == null) false; Insets insets = border.getBorderInsets(c); int x = e.getX(), y = e.getY(); int w = c.getWidth(), h = c.getHeight(); bool result = x < insets.left || x >= w-insets.right || y < insets.top || y >= h-insets.bottom; printVars ifdef mouseEventIsInBorder_debug("mouseEventIsInBorder " + result, +insets, +w, +h, +x, +y); ret result; }
Began life as a copy of #1033465
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035242 |
Snippet name: | mouseEventIsInBorder - did the mouse event happen in the border of a component? |
Eternal ID of this version: | #1035242/11 |
Text MD5: | dedeb7b0fc6a7a0936704df64981bb1c |
Transpilation MD5: | 7029e1a51d36f8b78eca082909650495 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-21 03:37:27 |
Source code size: | 546 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 166 / 273 |
Version history: | 10 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1036084 - ptFromEvent |