Libraryless. Click here for Pure Java version (9717L/53K).
static Rectangle restrictWindowToScreenSize_maxBounds = maxWindowBounds(); svoid restrictWindowToScreenSize(Window window) { if (window == null) ret; onBoundsChange(window, new Runnable { int recursionCounter; run { Rectangle max = restrictWindowToScreenSize_maxBounds; Rectangle r = window.getBounds(); if (r.width > max.width || r.height > max.height) { if (recursionCounter != 0) ret with warn("restrictWindowToScreenSize recursion"); ++recursionCounter; try { window.setSize(min(r.width, max.width), min(r.height, max.height)); } finally { --recursionCounter; } } } }); }
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035967 |
Snippet name: | restrictWindowToScreenSize |
Eternal ID of this version: | #1035967/3 |
Text MD5: | 7f7a26e6079a11cc4441763a5d7addba |
Transpilation MD5: | 666bc99bf79c2efb5b6953d86e84aab7 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-21 13:31:31 |
Source code size: | 740 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 155 / 213 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |