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).

!7

p-substance {
  JPanel panel = customLayoutPanel(func(Container parent) -> Dimension {
    Dimension size = parent.getSize();
    int y = 10;
    for (Component c : parent.getComponents()) {
      int h = c.getPreferredSize().height;
      c.setBounds(10, y, size.width-20, h);
      y += h + 10;
    }
    ret componentsBoundingSize(parent, 10);
  });
  
  for i to 10: panel.add(jtextfield());
  showFrame(panel);
}

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: 555 / 1212
Version history: 3 change(s)
Referenced in: