Transpiled version (7651L) is out of date.
sclass FormLayout1 extends AbstractLayoutManager { public void layoutContainer(Container parent) { L<Component> l = getComponents(parent); new BitSet bigOnes; for i over l: if (containsATextArea(l.get(i))) add(bigOnes, i); int nBigOnes = bigOnes.cardinality(); int mandatoryHeight = totalPreferredHeight(listWithoutIndicesInBitSet(l, bigOnes)); int gap = 4, outerSpacing = 5; Dimension size = parent.getSize(); int gapsAndMargins = outerSpacing*2+(l(l)-1)*gap; int totalSpace = size.height-gapsAndMargins; int liberalSpace = totalSpace-mandatoryHeight; double perBigOne = doubleRatio(liberalSpace, nBigOnes); printVars ifdef FormLayout1_debug(height := size.height, +gapsAndMargins, +totalSpace, +liberalSpace, +nBigOnes, +perBigOne); double y = outerSpacing; for i over l: { Component c = l.get(i); bool big = contains(bigOnes, i); double h = big ? perBigOne : c.getPreferredSize().height; int actualY = iround(y); c.setBounds(outerSpacing, actualY, size.width-outerSpacing*2, iround(y+h)-actualY); printVars ifdef FormLayout1_debug(+i, +big, cBounds := c.getBounds()); y += h+gap; } printVars ifdef FormLayout1_debug(+y); // set preferred size Dimension pref = componentsBoundingSize(parent, outerSpacing); if (parent.getHeight() <= 0) { // pre-showing - maybe we should always do this int tph = totalPreferredHeight(l); pref.height = tph+gapsAndMargins; } preferredSize(pref); } }
Began life as a copy of #1014730
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035072 |
Snippet name: | FormLayout1 - successor of formLayouter1 - splits available height among text areas |
Eternal ID of this version: | #1035072/8 |
Text MD5: | 88cd943c08587ecf75bd242d2e20d785 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-29 15:51:16 |
Source code size: | 1581 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 142 / 219 |
Version history: | 7 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) #1035946 - VScrollingWrapLayout - like WrapLayout but scrollable vertically [OK] |