--- old/modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java 2014-05-07 09:36:25.689069200 -0700 +++ new/modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java 2014-05-07 09:36:25.244043700 -0700 @@ -537,6 +537,34 @@ } } + private static String accessibilityTheme; + public static boolean setAccessibilityTheme(String themeName) { + if (accessibilityTheme != null) { + StyleManager.getInstance().removeUserAgentStylesheet(accessibilityTheme); + accessibilityTheme = null; + } + if (themeName == null) return false; + if(isModena) { + //pick the right one based on themeName + if (themeName.equals("High Contrast White")) { + accessibilityTheme = "com/sun/javafx/scene/control/skin/modena/whiteOnBlack.css"; + } else if (themeName.equals("High Contrast #1")) { + accessibilityTheme = "com/sun/javafx/scene/control/skin/modena/yellowOnBlack.css"; + } else if (themeName.equals("High Contrast Black")) { + accessibilityTheme = "com/sun/javafx/scene/control/skin/modena/blackOnWhite.css"; + } + } + if (isCaspian) { + // caspian only has one high contrast theme + accessibilityTheme = "com/sun/javafx/scene/control/skin/caspian/highcontrast.css"; + } + if (accessibilityTheme != null) { + StyleManager.getInstance().addUserAgentStylesheet(accessibilityTheme); + return true; + } + return false; + } + private static void _setPlatformUserAgentStylesheet(String stylesheetUrl) { isModena = isCaspian = false; // check for command line override @@ -623,6 +651,8 @@ } else { StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheetUrl); } + // Ensure that accessibility starts right + setAccessibilityTheme(Toolkit.getToolkit().getThemeName()); } public static void addNoTransparencyStylesheetToScene(final Scene scene) {