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

[macos] Inconsistent color of icon between stage window and within scene

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS 13.1 (22C65)
      Java 17

      A DESCRIPTION OF THE PROBLEM :
      When a png icon to a stage and then adding the same icon to the scene, the icon is has different colors between the stage title bar and the scene content. The colors in the stage title bar are relatively watered down.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a minimal hello world JavaFX App
      2. Have a png icon inside the resources folder
      3. Add that icon to the stage title bar
      4. Add that icon again inside the scene

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The icon should look the same between the stage title bar and the scene
      ACTUAL -
      It looks different

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application
      import javafx.geometry.Pos.TOP_CENTER
      import javafx.scene.Scene
      import javafx.scene.image.Image
      import javafx.scene.image.ImageView
      import javafx.scene.layout.VBox
      import javafx.stage.Stage


      fun main() {
        Application.launch(IconColorBug::class.java)
      }

      class IconColorBug: Application() {

        override fun start(primaryStage: Stage?) {
      primaryStage!!.apply {

      title = "stage title"

      val res = ClassLoader.getSystemClassLoader()!!.getResource("logo_32.png")!!.toString()
      icons.add(Image(res))
      scene = Scene(VBox().apply {
      alignment = TOP_CENTER
      prefWidth = 300.0
      prefHeight = 300.0
      children.add(ImageView(Image(res)))
      })
      }.show()
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I cannot find a workaround

      FREQUENCY : always


        1. IconBug.java
          0.9 kB
        2. java-coffee-cup-logo.png
          java-coffee-cup-logo.png
          4 kB
        3. Ubuntu_Capture.PNG
          Ubuntu_Capture.PNG
          30 kB
        4. Windows_Capture.PNG
          Windows_Capture.PNG
          17 kB

            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: