Libraryless. Click here for Pure Java version (9246L/51K).
1 | // layouter: voidfunc(Container) |
2 | // or func(Container) -> Dimension [preferred size] |
3 | // or func(Container) -> Pair(Dimension, Dimension) [preferred, minimum] |
4 | static LayoutManager layoutManagerFromFunction(fO layouter) { |
5 | if (layouter cast LayoutManager) ret layouter; |
6 | |
7 | ret new AbstractLayoutManager { |
8 | public void layoutContainer(Container parent) { |
9 | O size = pcallF(layouter, parent); |
10 | if (size cast Dimension) |
11 | preferredSize = size; |
12 | else if (size cast Pair) { |
13 | preferredSize = (Dimension) size.a; |
14 | minimumSize = (Dimension) size.b; |
15 | } |
16 | } |
17 | }; |
18 | } |
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: | 616 / 729 |
Version history: | 4 change(s) |
Referenced in: | [show references] |