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

25
LINES

< > BotCompany Repo | #1007331 // hstackWithSpacing function (layout components left to right, try to fill full height, dev.)

JavaX fragment (include)

static int hstackWithSpacing_spacing = 10;

// first part can be spacing value
static JPanel hstackWithSpacing(O... parts) {
  parts = flattenArray2(parts); // allow collections in parameters
  int spacing = hstackWithSpacing_spacing;
  int i = 0;
  if (first(parts) instanceof Int) {
    spacing = toInt(first(parts));
    ++i;
  }
  JPanel panel = new JPanel(new GridBagLayout);
  new GridBagConstraints gbc;
  gbc.weighty = 1;
  gbc.fill = GridBagConstraints.VERTICAL;
  gbc.gridheight = GridBagConstraints.REMAINDER;
  for (; i < l(parts); i++) {
    if (i != 0)
      panel.add(javax.swing.Box.createRigidArea(new Dimension(spacing, 0)), gbc);
    panel.add(wrapForSmartAdd(parts[i]), gbc);
  }
  gbc.weightx = 1;
  panel.add(jrigid(), gbc);
  ret panel;
}

Author comment

Began life as a copy of #1007328

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: #1007331
Snippet name: hstackWithSpacing function (layout components left to right, try to fill full height, dev.)
Eternal ID of this version: #1007331/9
Text MD5: d5ef2811f181eb284bf29830925ce509
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-06 17:22:51
Source code size: 785 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 421 / 480
Version history: 8 change(s)
Referenced in: [show references]