void (Container parent) { int count = parent.getComponentCount(); int width = parent.getWidth() - JBUIScale.scale(32); int height = parent.getHeight(); if (count == 1) { parent.getComponent(0).setBounds(JBUIScale.scale(16), 0, width, height); } else { int y = 0; for (int i = 0; i < count; i++) { Component component = parent.getComponent(i); Dimension size = component.getPreferredSize(); component.setBounds(JBUIScale.scale(16), y, width, size.height); y += size.height + VERTICAL_GAP; } } }