/** Paints selection for the specified <code>component</code>. */ public static void paintSelectionDecoration( @NotNull RadComponent component, Graphics g, boolean focused) { if (component.isSelected()) { if (focused) { g.setColor(PlatformColors.BLUE); } else { g.setColor(Color.GRAY); } final Point[] points = getPoints(component.getWidth(), component.getHeight()); for (final Point point : points) { g.fillRect(point.x - R, point.y - R, 2 * R + 1, 2 * R + 1); } } else if (component.getWidth() < FormEditingUtil.EMPTY_COMPONENT_SIZE || component.getHeight() < FormEditingUtil.EMPTY_COMPONENT_SIZE) { Graphics2D g2d = (Graphics2D) g; Composite oldComposite = g2d.getComposite(); Stroke oldStroke = g2d.getStroke(); Color oldColor = g2d.getColor(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f)); g2d.setStroke(new BasicStroke(0.7f)); g2d.setColor(Color.black); g2d.drawRect( 0, 0, Math.max(component.getWidth(), FormEditingUtil.EMPTY_COMPONENT_SIZE), Math.max(component.getHeight(), FormEditingUtil.EMPTY_COMPONENT_SIZE)); g2d.setComposite(oldComposite); g2d.setStroke(oldStroke); g2d.setColor(oldColor); } }