static JPanel gridLayoutPanel_trackWidth_evenlySpacedCols(final int cols) { ret customLayoutPanel_trackWidth(func(Container parent) { int gap = 10; Dimension size = parent.getSize(); int w = max(100, size.width)-gap*2; int y = gap; LL<Component> rows = groupInFixedSizeRows(parent.getComponents(), cols); new L<Int> colWidths; for i to cols: colWidths.add((i+1)*w/cols-i*w/cols); for (L<Component> row : rows) { int h = 0, x = gap; for (Component c : row) h = max(h, c.getPreferredSize().height); for i over row: { row.get(i).setBounds(x, y, colWidths.get(i)-gap, h); x += colWidths.get(i); } y += h + gap; } ret componentsBoundingSize(parent, gap); }); }
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: | #1008612 |
| Snippet name: | gridLayoutPanel_trackWidth_evenlySpacedCols |
| Eternal ID of this version: | #1008612/1 |
| Text MD5: | d1150e1fa731ac711f857e31b4745d4f |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-05-25 19:09:01 |
| Source code size: | 786 bytes / 24 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 780 / 789 |
| Referenced in: | [show references] |