Libraryless. Click here for Pure Java version (2333L/15K).
static Window moveWindowIntoScreen(final Window w) { if (w != null) swing { Rectangle s = usableWindowArea(); Rectangle r1 = w.getBounds(); Rectangle r = new Rectangle(r1); // adjust size r.width = min(r.width, s.width); r.height = min(r.height, s.height); // adjust position r.x = min(x2(s)-r.width, max(r.x, s.x)); r.y = min(y2(s)-r.height, max(r.y, s.y)); if (neq(r, r1)) w.setBounds(r); } ret w; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1014840 |
Snippet name: | moveWindowIntoScreen - for restoring windows with coordinates possibly from another screen |
Eternal ID of this version: | #1014840/5 |
Text MD5: | 4f66a09f98f81a3410152fc9ba02dac8 |
Transpilation MD5: | 58e78eba2a65e747760656950da4c237 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-04 15:10:26 |
Source code size: | 486 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 369 / 463 |
Version history: | 4 change(s) |
Referenced in: | [show references] |