// TODO: all the fringe cases (?) static <A> JPanel hvgrid(L<L<A>> components) { if (empty(components)) ret new JPanel; int h = l(components), w = l(first(components)); new JPanel panel; panel.setLayout(new GridLayout(h, w)); for (L<A> row : components) smartAdd(panel, row); ret panel; } static <A> JPanel hvgrid(L<L<A>> components, int gap) { JPanel panel = hvgrid(components); GridLayout g = cast panel.getLayout(); g.setHgap(gap); g.setVgap(gap); ret panel; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004433 |
Snippet name: | hvgrid - make 2-dimensional GridLayout |
Eternal ID of this version: | #1004433/1 |
Text MD5: | 890cb4affbb5cde85b57d84e5a062e5b |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-25 16:35:02 |
Source code size: | 509 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 745 / 708 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1026632 - hvgrid_distribute (try to arrange components in a square) |