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; }