Get each component from the awt Color object and use the static method javafx.scene.paint.Color.rgb(...) . Note that awt Color has a getAlpha() method that returns alpha as an int in the range 0-255 , while javafx.scene.paint.Color.rgb(...) expects an alpha value as a double in the range 0.0-1.0 :
java.awt.Color awtColor = ... ; int r = awtColor.getRed(); int g = awtColor.getGreen(); int b = awtColor.getBlue(); int a = awtColor.getAlpha(); double opacity = a / 255.0 ; javafx.scene.paint.Color fxColor = javafx.scene.paint.Color.rgb(r, g, b, opacity);
James_d
source share