We want to have a circle filled with a profile picture, loading the URL of the image.
We have tried loading the image with a URL on Windows, Linux, and MacOS. Turns out that the image processing works on Linux and MacOS, but doesn't work on Windows.
Circle circle = new Circle(25);
Image image = new Image("https://i.imgur.com/itElfV3.jpg");
circle.setFill(new ImagePattern(image));
We expect to have the circle with the profile picture inside it. But the result is a NullPointerException on Windows. The error we then get is:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Image must be non-null
at com.sun.prism.paint.ImagePattern.<init>(ImagePattern.java:44)
at com.sun.javafx.tk.quantum.QuantumToolkit.createImagePatternPaint(QuantumToolkit.java:905)
at com.sun.javafx.tk.Toolkit.getPaint(Toolkit.java:657)
at javafx.scene.paint.ImagePattern.acc_getPlatformPaint(ImagePattern.java:291)
at javafx.scene.paint.Paint$1.getPlatformPaint(Paint.java:51)
at javafx.scene.shape.Shape.updatePGShape(Shape.java:916)
at javafx.scene.shape.Shape.impl_updatePeer(Shape.java:965)
at javafx.scene.shape.Circle.impl_updatePeer(Circle.java:333)
at javafx.scene.Node.impl_syncPeer(Node.java:503)
at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:2304)
at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:2313)
at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:2313)
at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:2313)
at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Scene.java:2280)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2419)
at com.sun.javafx.tk.Toolkit.lambda$runPulse$29(Toolkit.java:398)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:424)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$403(QuantumToolkit.java:319)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
The code does work on Windows if we load the image locally, but since we want users to be able to upload a new URL to their own profile pictures, we would like to use a link.