Libraryless. Click here for Pure Java version (5043L/28K).
static <A extends Component> A centerFrame(A c) { Window w = getWindow(c); if (w != null) swing { var r = preferredScreenBounds(); w.setLocation( r.x+(r.w-w.getWidth())/2, r.y+(r.h-w.getHeight())/2); } ret c; } static <A extends Component> A centerFrame(int w, int h, A c) { ret centerFrame(setFrameSize(w, h, c)); }
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: | #1001308 |
| Snippet name: | centerFrame |
| Eternal ID of this version: | #1001308/8 |
| Text MD5: | 6211d216a717d55ed88ff4be136b4053 |
| Transpilation MD5: | 68500a1ee26263e256e72e5872a70968 |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-21 20:38:03 |
| Source code size: | 362 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1017 / 1739 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |