1
1
/*
2
- * Copyright (c) 2010, 2024 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2010, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -413,6 +413,7 @@ public static boolean canStartNestedEventLoop() {
413
413
private static ReadOnlyBooleanWrapper accessibilityActiveProperty ;
414
414
415
415
public static boolean isAccessibilityActive () {
416
+ Toolkit .getToolkit ().checkFxUserThread ();
416
417
return accessibilityActiveProperty == null ? false : accessibilityActiveProperty .get ();
417
418
}
418
419
@@ -421,14 +422,17 @@ public static boolean isAccessibilityActive() {
421
422
* This property is typically set to true the first time an
422
423
* assistive technology, such as a screen reader, requests
423
424
* information about any JavaFX window or its children.
424
- *
425
- * <p> This method may be called from any thread.</p>
425
+ * <p>
426
+ * This property can be accessed only from the JavaFX Application Thread.
426
427
*
427
428
* @return the read-only boolean property indicating if accessibility is active
428
429
*
430
+ * @throws IllegalStateException if this method is called on a thread
431
+ * other than the JavaFX Application Thread.
429
432
* @since JavaFX 8u40
430
433
*/
431
434
public static ReadOnlyBooleanProperty accessibilityActiveProperty () {
435
+ Toolkit .getToolkit ().checkFxUserThread ();
432
436
if (accessibilityActiveProperty == null ) {
433
437
accessibilityActiveProperty = new ReadOnlyBooleanWrapper (Platform .class , "accessibilityActive" );
434
438
accessibilityActiveProperty .bind (PlatformImpl .accessibilityActiveProperty ());
@@ -445,12 +449,15 @@ public static ReadOnlyBooleanProperty accessibilityActiveProperty() {
445
449
* by JavaFX when the operating system reports that a platform preference has changed.
446
450
*
447
451
* @return the {@code Preferences} instance
452
+ * @throws IllegalStateException if this method is called on a thread
453
+ * other than the JavaFX Application Thread.
448
454
* @see <a href="Platform.Preferences.html#preferences-table-windows">Windows preferences</a>
449
455
* @see <a href="Platform.Preferences.html#preferences-table-macos">macOS preferences</a>
450
456
* @see <a href="Platform.Preferences.html#preferences-table-linux">Linux preferences</a>
451
457
* @since 22
452
458
*/
453
459
public static Preferences getPreferences () {
460
+ Toolkit .getToolkit ().checkFxUserThread ();
454
461
PlatformImpl .checkPreferencesSupport ();
455
462
return PlatformImpl .getPlatformPreferences ();
456
463
}
1 commit comments
openjdk-notifier[bot] commentedon Mar 14, 2025
Review
Issues