@@ -686,7 +686,13 @@ public final class FXUtils {
|
|||||||
* @see ResourceNotFoundError
|
* @see ResourceNotFoundError
|
||||||
*/
|
*/
|
||||||
public static Image newBuiltinImage(String url) {
|
public static Image newBuiltinImage(String url) {
|
||||||
return newBuiltinImage(url, 0, 0, false, false);
|
return builtinImageCache.computeIfAbsent(url, s -> {
|
||||||
|
try {
|
||||||
|
return new Image(s);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new ResourceNotFoundError("Cannot access image: " + s, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -706,13 +712,11 @@ public final class FXUtils {
|
|||||||
* @see ResourceNotFoundError
|
* @see ResourceNotFoundError
|
||||||
*/
|
*/
|
||||||
public static Image newBuiltinImage(String url, double requestedWidth, double requestedHeight, boolean preserveRatio, boolean smooth) {
|
public static Image newBuiltinImage(String url, double requestedWidth, double requestedHeight, boolean preserveRatio, boolean smooth) {
|
||||||
return builtinImageCache.computeIfAbsent(url, s -> {
|
try {
|
||||||
try {
|
return new Image(url, requestedWidth, requestedHeight, preserveRatio, smooth);
|
||||||
return new Image(s, requestedWidth, requestedHeight, preserveRatio, smooth);
|
} catch (IllegalArgumentException e) {
|
||||||
} catch (IllegalArgumentException e) {
|
throw new ResourceNotFoundError("Cannot access image: " + url, e);
|
||||||
throw new ResourceNotFoundError("Cannot access image: " + s, e);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user