void (final int cell, final FormLayout formLayout, final FormSpec newSpec, final boolean isRow) { int[][] groups = isRow ? formLayout.getRowGroups() : formLayout.getColumnGroups(); for(int[] group: groups) { boolean foundGroup = false; for(int groupCell: group) { if (groupCell == cell+1) { foundGroup = true; break; } } if (foundGroup) { for(int groupCell: group) { setSpec(formLayout, newSpec, groupCell, isRow); } break; } } }