public static JPanel createGrid(JComponent[]... cmps) { JPanel somePanel = createPanel(); int rows = cmps.length; int cols = rows == 0 ? 0 : cmps[0].length; for (JComponent[] row : cmps) { for (JComponent cell : row) { somePanel.add(SwingFactory.createPadding(cell)); } } CSS.grid(somePanel, rows, cols); return SwingFactory.createPadding(somePanel); }
/** * Allows user to quickly create sequences of elements with predefined padding in between. Its * public versions are createXSequence and createYSequence */ private static JPanel createSequence(JComponent... cmps) { JPanel pane = createPanel(); for (JComponent comp : cmps) { CSS.align(comp); pane.add(SwingFactory.createPadding(comp)); } return pane; }