@Override
		public void paintIcon( Component c, Graphics g, int x, int y ) {
			int width = getIconWidth();
			int height = getIconHeight();

			try {
				g.setColor( UIManager.getColor( "Panel.background" ) );
				g.fillRect( x, y, width, height );

				icon.paintIcon( c, g, x, y );
			} catch( Exception ex ) {
				g.setColor( Color.red );
				g.drawRect( x, y, width - 1, height - 1 );
			}
		}
Creates a UI defaults inspector panel that can be embedded into any window.
flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatUIDefaultsInspector.java