Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8158146

Conversion helper for AWT Color to JavaFX Paint/SystemColor Palettes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u92
    • javafx

      A DESCRIPTION OF THE REQUEST :
      Converting AWT Colors to JavaFX Paint.Color values requires a bit of boilerplate. JavaFX has no equivalent of java.awt.SystemColor which could be used to implement native styles. The addition of a helper function to convert AWT colors and a new SystemColor API for JavaFX would solve these problems.

      JUSTIFICATION :
      For any progress to be made on JDK-8129408 or JDK-8090700 it will be necessary to have access to the native OS color palettes as JavaFX Paint Colors.


      CUSTOMER SUBMITTED WORKAROUND :
      From StackOverflow:
      http://stackoverflow.com/questions/30466405/java-convert-java-awt-color-to-javafx-scene-paint-color


      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);

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: