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

18
LINES

< > BotCompany Repo | #1004433 - hvgrid - make 2-dimensional GridLayout

JavaX fragment (include)

// TODO: all the fringe cases (?)
static <A> JPanel hvgrid(L<L<A>> components) {
  if (empty(components)) ret new JPanel;
  int h = l(components), w = l(first(components));
  new JPanel panel;
  panel.setLayout(new GridLayout(h, w));
  for (L<A> row : components)
    smartAdd(panel, row);
  ret panel;  
}

static <A> JPanel hvgrid(L<L<A>> components, int gap) {
  JPanel panel = hvgrid(components);
  GridLayout g = cast panel.getLayout();
  g.setHgap(gap);
  g.setVgap(gap);
  ret panel;
}

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1004433
Snippet name: hvgrid - make 2-dimensional GridLayout
Eternal ID of this version: #1004433/1
Text MD5: 890cb4affbb5cde85b57d84e5a062e5b
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-25 16:35:02
Source code size: 509 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 411 / 347
Referenced in: [show references]

Formerly at http://tinybrain.de/1004433 & http://1004433.tinybrain.de