Libraryless. Click here for Pure Java version (9246L/51K).
// layouter: voidfunc(Container) // or func(Container) -> Dimension [preferred size] // or func(Container) -> Pair(Dimension, Dimension) [preferred, minimum] static LayoutManager layoutManagerFromFunction(fO layouter) { if (layouter cast LayoutManager) ret layouter; ret new AbstractLayoutManager { public void layoutContainer(Container parent) { O size = pcallF(layouter, parent); if (size cast Dimension) preferredSize = size; else if (size cast Pair) { preferredSize = (Dimension) size.a; minimumSize = (Dimension) size.b; } } }; }
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: | #1008610 |
Snippet name: | layoutManagerFromFunction |
Eternal ID of this version: | #1008610/5 |
Text MD5: | 23efa97b1cc46b477147f7fab051b3bf |
Transpilation MD5: | 2c1fad831f02a16a263e787152cf938a |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-09-07 05:51:45 |
Source code size: | 616 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 615 / 727 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |