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

The special high-contrast mode of JavaFX Controls in Japanese environment do not work.

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_141"
      Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
      Java HotSpot(TM) Client VM (build 25.141-b15, mixed mode, sharing)

      and

      java version "9"
      Java(TM) SE Runtime Environment (build 9+179)
      Java HotSpot(TM) Server VM (build 9+179, mixed mode, emulated-client)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Japanese environment.

      A DESCRIPTION OF THE PROBLEM :
      <a href="http://openjdk.java.net/jeps/204">JavaFX Accessibility(JEP 204)</a> includes "a special high-contrast mode must be supported that makes controls more visible to users".

      When changing the special high-contrast mode of Windows 7, the special high-contrast mode of JavaFX Controls in Japanese environment will not work.
      The colors of the title area of the native window was changed by selecting the special high-contrast mode of Windows OS, but the color of JavaFX Controls was not changed in Japanese environment.

      The following partial code is a method of selecting the CSS of JavaFX Controls by selecting the special high-contrast mode of Windows OS.
      This method is com.sun.javafx.application.PlatformImpl#_setAccessibilityTheme(String platformTheme).

      <http://hg.openjdk.java.net/openjfx/8u/rt/file/96421cca7f9c/modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java>

      600 // The following names are Platform specific (Windows 7 and 8)
      601 switch (platformTheme) {
      602 case "High Contrast White":
      603 accessibilityTheme = "com/sun/javafx/scene/control/skin/modena/blackOnWhite.css";
      604 break;
      605 case "High Contrast Black":
      606 accessibilityTheme = "com/sun/javafx/scene/control/skin/modena/whiteOnBlack.css";
      607 break;
      608 case "High Contrast #1":
      609 case "High Contrast #2": //TODO #2 should be green on black
      610 accessibilityTheme = "com/sun/javafx/scene/control/skin/modena/yellowOnBlack.css";
      611 break;
      612 default:
      613 }

      Supplementally, platformTheme is a special high contrast mode value of the Windows OS and is obtained from the com.sun.javafx.tk.Toolkit#getThemeName() method.

      691 // Ensure that accessibility starts right
      692 _setAccessibilityTheme(Toolkit.getToolkit().getThemeName());


      In this code,
      if the value of platformTheme is "High Contrast White", "com/sun/javafx/scene/control/skin/modena/blackOnWhite.css" will be set in the CSS of JavaFX Contorls.
      Likewise, if the value of platformTheme is "High Contrast Black", "com/sun/javafx/scene/control/skin/modena/blackOnWhite.css" will be set in the CSS of JavaFX Contorls.
      etc...

      This code is correct in English environment, but this code is not correct in Japanese environment.

      The following list is the values of Windows theme name in Japanese environment.

       "ハイコントラスト 白" ("High Contrast White" in English environment)
       "ハイコントラスト 黒" ("High Contrast Black" in English environment)
       "ハイコントラスト #1" ("High Contrast #1" in English environment)
       "ハイコントラスト #2" ("High Contrast #2" in English environment)

      The value of Windows theme name is different in Japanese environment and English environment.
      Therefore, in the Japanese environment, this code does not select the special high contrast mode CSS of the JavaFX control.

      It means that this code is not aware of the values of Windows theme name in multilingual environment.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On Windows 7 in Japanese environment,
      the source code that displays the JavaFX window containing the JavaFX control can be reproduced at any time.

      1. Execute JavaFX application, and show JavaFX Window.
      2. Changing the special high-contrast mode of Windows 7.
          ex. Select "High Contrast Black".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The colors of both the title area of the native window and JavaFX Controls was changed by selecting the special high-contrast mode of Windows OS.
      ACTUAL -
      The colors of the title area of the native window was changed by selecting the special high-contrast mode of Windows OS, but the color of JavaFX Controls was not changed.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class AccessibilityTest extends Application {
          public void start(Stage primaryStage) {
              Button btn = new Button();
              btn.setText("Say 'Hello World'");
              btn.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent event) {
                      System.out.println("Hello World!");
                  }
              });
              StackPane root = new StackPane();
              root.getChildren().add(btn);
              Scene scene = new Scene(root, 300, 250);
              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
          }
          
          public static void main(String[] args) {
              launch(args);
          }
      }
      ---------- END SOURCE ----------

        Attachments

        1. AccessibilityTest.java
          1.0 kB
        2. Eng.png
          Eng.png
          171 kB
        3. Jpn.png
          Jpn.png
          129 kB

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: