void (final Result[] resultArray) { int leftGap = myHGap/2; int rightGap = myHGap - myHGap/2; int topGap = myVGap / 2; int bottomGap = myVGap - myVGap/2; for (Result result : resultArray) { if (result.constraints.gridx > 0) { result.constraints.insets.left += leftGap; } if (result.constraints.gridx + result.constraints.gridwidth - 1 < myLastCol) { result.constraints.insets.right += rightGap; } if (result.constraints.gridy > 0) { result.constraints.insets.top += topGap; } if (result.constraints.gridy + result.constraints.gridheight - 1 < myLastRow) { result.constraints.insets.bottom += bottomGap; } } }