public static String getClippedString( JComponent c, FontMetrics fm, String string, int availTextWidth ) {
		synchronized( JavaCompatibility.class ) {
			if( getClippedStringMethod == null ) {
				try {
					Class<?> cls = Class.forName( SystemInfo.isJava_9_orLater
						? "javax.swing.plaf.basic.BasicGraphicsUtils"
						: "sun.swing.SwingUtilities2" );
					MethodType mt = MethodType.methodType( String.class, JComponent.class, FontMetrics.class, String.class, int.class );
					getClippedStringMethod = MethodHandles.publicLookup().findStatic( cls, SystemInfo.isJava_9_orLater
							? "getClippedString"
							: "clipStringIfNecessary",
						mt );
				} catch( Exception ex ) {
					LoggingFacade.INSTANCE.logSevere( null, ex );
					throw new RuntimeException( ex );
				}
			}
		}

		try {
			return (String) getClippedStringMethod.invoke( c, fm, string, availTextWidth );
		} catch( Throwable ex ) {
			LoggingFacade.INSTANCE.logSevere( null, ex );
			throw new RuntimeException( ex );
		}
	}
Java 8: sun.swing.SwingUtilities2.clipStringIfNecessary( JComponent c,
				FontMetrics fm, String string, int availTextWidth )
<br>
Java 9: javax.swing.plaf.basic.BasicGraphicsUtils.getClippedString( JComponent c,
				FontMetrics fm, String string, int availTextWidth )
flatlaf-core/src/main/java/com/formdev/flatlaf/util/JavaCompatibility.java