Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1008605 // Custom layout manager, adapt to window size [shortened 2]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (6414L/42K).

1  
!7
2  
3  
p-substance {
4  
  JPanel panel = customLayoutPanel(func(Container parent) -> Dimension {
5  
    Dimension size = parent.getSize();
6  
    int y = 10;
7  
    for (Component c : parent.getComponents()) {
8  
      int h = c.getPreferredSize().height;
9  
      c.setBounds(10, y, size.width-20, h);
10  
      y += h + 10;
11  
    }
12  
    ret componentsBoundingSize(parent, 10);
13  
  });
14  
  
15  
  for i to 10: panel.add(jtextfield());
16  
  showFrame(panel);
17  
}

Author comment

Began life as a copy of #1008603

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: #1008605
Snippet name: Custom layout manager, adapt to window size [shortened 2]
Eternal ID of this version: #1008605/4
Text MD5: 5551fcb31a4557127117a5d5f31fb5ab
Transpilation MD5: 3fe19d8e143cdc95ab2337c5fe82debf
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-01 14:03:19
Source code size: 437 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 438 / 962
Version history: 3 change(s)
Referenced in: [show references]