Libraryless. Click here for Pure Java version (9717L/53K).
1 | static Rectangle restrictWindowToScreenSize_maxBounds = maxWindowBounds(); |
2 | |
3 | svoid restrictWindowToScreenSize(Window window) { |
4 | if (window == null) ret; |
5 | onBoundsChange(window, new Runnable { |
6 | int recursionCounter; |
7 | |
8 | run { |
9 | Rectangle max = restrictWindowToScreenSize_maxBounds; |
10 | Rectangle r = window.getBounds(); |
11 | if (r.width > max.width || r.height > max.height) { |
12 | if (recursionCounter != 0) |
13 | ret with warn("restrictWindowToScreenSize recursion"); |
14 | |
15 | ++recursionCounter; |
16 | try { |
17 | window.setSize(min(r.width, max.width), |
18 | min(r.height, max.height)); |
19 | } finally { |
20 | --recursionCounter; |
21 | } |
22 | } |
23 | } |
24 | }); |
25 | } |
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: | 154 / 212 |
Version history: | 2 change(s) |
Referenced in: | [show references] |