Lukas Lukas - 3 months ago 64
Java Question

How to convert javafx.scene.paint.Color to java.awt.Color ?

How to convert javafx.scene.paint.Color to java.awt.Color in java?
Any ideas ?

Answer

You could use the constructor that accepts r,g,b and alpha parameters:

javafx.scene.paint.Color fx = ...;

java.awt.Color awtColor = new java.awt.Color((float) fx.getRed(),
                                             (float) fx.getGreen(),
                                             (float) fx.getBlue(),
                                             (float) fx.getOpacity());