void () { JComponent mainComponent = createMainComponent(); JButton[] buttons = createButtons(); @Nls String labelText = getLabelText(); if (labelText != null) { setBorder(IdeBorderFactory.createTitledBorder(labelText, false)); } add( mainComponent, new GridBagConstraints(0, 1, 1, buttons.length == 0 ? 1 : buttons.length, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, buttons.length == 0 ? 0 : 4), 0, 0) ); for (int i = 0; i < buttons.length; i++) { JButton button = buttons[i]; add( button, new GridBagConstraints(1, 1 + i, 1, 1, 0, (i == buttons.length - 1 ? 1 : 0), GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 0, 0) ); } }