void (final RadContainer container, final boolean isRow, final int index, final Graphics2D g2d, final Rectangle rc) { // don't paint gap rows/columns with red background if (isGapCell(container, isRow, index)) { g2d.setColor(Color.LIGHT_GRAY); g2d.fillRect(rc.x, rc.y, rc.width, rc.height); } if (canCellGrow(container, isRow, index)) { drawGrowMarker(isRow, g2d, rc); } FormLayout layout = (FormLayout) container.getLayout(); int[][] groups = isRow ? layout.getRowGroups() : layout.getColumnGroups(); //noinspection MultipleVariablesInDeclaration boolean haveTopLeft = false, haveTopRight = false, haveTopLine = false; //noinspection MultipleVariablesInDeclaration boolean haveBottomLeft = false, haveBottomRight = false, haveBottomLine = false; boolean inGroup = false; for(int i=0; i<groups.length; i++) { int minMember = Integer.MAX_VALUE; int maxMember = -1; for(int member: groups [i]) { minMember = Math.min(member-1, minMember); maxMember = Math.max(member-1, maxMember); inGroup = inGroup || (member-1 == index); } if (minMember <= index && index <= maxMember) { if (i % 2 == 0) { haveTopLeft = haveTopLeft || index > minMember; haveTopRight = haveTopRight || index < maxMember; haveTopLine = haveTopLine || inGroup; } else { haveBottomLeft = haveBottomLeft || index > minMember; haveBottomRight = haveBottomRight || index < maxMember; haveBottomLine = haveBottomLine || inGroup; } } } g2d.setColor(PlatformColors.BLUE); drawGroupLine(rc, isRow, g2d, true, haveTopLeft, haveTopRight, haveTopLine); drawGroupLine(rc, isRow, g2d, false, haveBottomLeft, haveBottomRight, haveBottomLine); }