protected void updateDockIconPreview() {
		// make sure that frame is not selected
		if( frame.isSelected() ) {
			try {
				frame.setSelected( false );
			} catch( PropertyVetoException ex ) {
				// ignore
			}
		}

		// layout internal frame title pane, which was recreated when switching Laf
		// (directly invoke doLayout() because frame.validate() does not work here
		// because frame is not displayable)
		if( !frame.isValid() )
			frame.doLayout();
		for( Component c : frame.getComponents() ) {
			if( !c.isValid() )
				c.doLayout();
		}

		// paint internal frame to buffered image
		int frameWidth = Math.max( frame.getWidth(), 1 );
		int frameHeight = Math.max( frame.getHeight(), 1 );
		BufferedImage frameImage = new BufferedImage( frameWidth, frameHeight, BufferedImage.TYPE_INT_ARGB );
		Graphics2D g = frameImage.createGraphics();
		try {
			frame.paint( g );
		} finally {
			g.dispose();
		}

		// compute preview size (keep ratio; also works with non-square preview)
		Insets insets = desktopIcon.getInsets();
		int previewWidth = UIScale.scale( iconSize.width ) - insets.left - insets.right;
		int previewHeight = UIScale.scale( iconSize.height ) - insets.top - insets.bottom;
		float frameRatio = ((float) frameHeight / (float) frameWidth);
		if( ((float) previewWidth / (float) frameWidth) > ((float) previewHeight / (float) frameHeight) )
			previewWidth = Math.round( previewHeight / frameRatio );
		else
			previewHeight = Math.round( previewWidth * frameRatio );

		// scale preview
		Image previewImage = frameImage.getScaledInstance( previewWidth, previewHeight, Image.SCALE_SMOOTH );
		if( MultiResolutionImageSupport.isAvailable() ) {
			// On HiDPI screens, create preview images for 1x, 2x and current scale factor.
			// The icon then chooses the best resolution for painting, which is usually
			// the one for the current scale factor. But if changing scale factor or
			// moving window to another screen with different scale factor, then another
			// resolution may be used because the preview icon is not updated.
			Image previewImage2x = frameImage.getScaledInstance( previewWidth * 2, previewHeight * 2, Image.SCALE_SMOOTH );
			double scaleFactor = UIScale.getSystemScaleFactor( desktopIcon.getGraphicsConfiguration() );
			if( scaleFactor != 1 && scaleFactor != 2 ) {
				Image previewImageCurrent = frameImage.getScaledInstance(
					(int) Math.round( previewWidth * scaleFactor ),
					(int) Math.round( previewHeight * scaleFactor ),
					Image.SCALE_SMOOTH );

				// the images must be ordered by resolution
				previewImage = (scaleFactor < 2)
					? MultiResolutionImageSupport.create( 0, previewImage, previewImageCurrent, previewImage2x )
					: MultiResolutionImageSupport.create( 0, previewImage, previewImage2x, previewImageCurrent );
			} else
				previewImage = MultiResolutionImageSupport.create( 0, previewImage, previewImage2x );
		}
		dockIcon.setIcon( new ImageIcon( previewImage ) );
	}
Provides the Flat LaF UI delegate for {@link javax.swing.JInternalFrame.JDesktopIcon}.

<!-- BasicDesktopIconUI -->

@uiDefault DesktopIcon.border					Border

<!-- FlatDesktopIconUI -->

@uiDefault DesktopIcon.background				Color
@uiDefault DesktopIcon.foreground				Color
@uiDefault DesktopIcon.iconSize					Dimension
@uiDefault DesktopIcon.closeSize					Dimension
@uiDefault DesktopIcon.closeIcon					Icon

@author Karl Tauber
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatDesktopIconUI.java