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

High contrast themes are not used in non-english locales

XMLWordPrintable

      FULL PRODUCT VERSION :
      C:\WINDOWS\system32>java -version
      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10 x64 Home

      Microsoft Windows [Version 10.0.15063]

      A DESCRIPTION OF THE PROBLEM :
      In non-English locales the high contrast setting in Windows is not respected by JavaFX

      I believe this is to do with the method _setAccessibilityTheme(String platformTheme) in com.sun.javafx.application.PlatformImple.java, it's doing logic around hard-coded English strings

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Change your windows locale to something other than English (you may need to log out and back in again)
      Enable high contrast in Windows
      Run the included demo program

      You'll see that the JavaFX stage is not using a high contrast theme

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A high contrast theme, the same as when the locale is english
      ACTUAL -
      The theme is unchanged

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package main;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class Accessibility extends Application
      {
          @Override
          public void start(
              Stage primaryStage) throws Exception
          {
              final MenuItem close = new MenuItem("Close");
              final Menu file = new Menu("File");
              file.getItems().add(close);
              final MenuBar menuBar = new MenuBar(file);
              
              final VBox root = new VBox();
              root.getChildren().add(menuBar);
              
              primaryStage.setScene(new Scene(root));
              primaryStage.show();
          }
          
          public static void main(
              String[] args)
          {
              launch(args);
          }

      }

      ---------- END SOURCE ----------

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: