public static void paintComponentTag(final RadComponent component, final Graphics g) { if (component instanceof RadContainer) return; for (IProperty prop : component.getModifiedProperties()) { if (prop.getName().equals(SwingProperties.TEXT)) { final Object desc = prop.getPropertyValue(component); if (!(desc instanceof StringDescriptor) || ((StringDescriptor) desc).getValue() == null || ((StringDescriptor) desc).getValue().length() > 0) { return; } } else if (prop.getName().equals(SwingProperties.MODEL)) { // don't paint tags on non-empty lists final Object value = prop.getPropertyValue(component); if (value instanceof String[] && ((String[]) value).length > 0) { return; } } } Rectangle bounds = component.getDelegee().getBounds(); if (bounds.width > 100 && bounds.height > 40) { StringBuilder tagBuilder = new StringBuilder(); if (component.getBinding() != null) { tagBuilder.append(component.getBinding()).append(':'); } String className = component.getComponentClassName(); int pos = className.lastIndexOf('.'); if (pos >= 0) { tagBuilder.append(className.substring(pos + 1)); } else { tagBuilder.append(className); } final Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(tagBuilder.toString(), g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(PlatformColors.BLUE); g2d.fillRect(0, 0, (int) stringBounds.getWidth(), (int) stringBounds.getHeight()); g2d.setColor(Color.WHITE); g.drawString(tagBuilder.toString(), 0, g.getFontMetrics().getAscent()); } }