Class AccessibilityHelper

java.lang.Object
com.digitizer.ui.AccessibilityHelper

public class AccessibilityHelper extends Object
Accessibility utility helper class for configuring JavaFX controls with screen reader support, keyboard shortcuts, and ARIA-like descriptions.

The helper contains convenience methods to configure controls with Tooltips, accessible labels and role descriptions so screen reader users can discover UI semantics and keyboard alternatives. The helper also logs "announcements" which can be picked up by platform-specific accessibility tools.

  • Constructor Details

    • AccessibilityHelper

      public AccessibilityHelper()
  • Method Details

    • setButtonAccessibility

      public static void setButtonAccessibility(javafx.scene.control.Button button, String text, String tooltip, String keyboardHint)
      Sets an accessible label and tooltip for a button. Logs the action for screen reader announcement.
      Parameters:
      button - the button to configure
      text - the button text
      tooltip - the tooltip text describing the button action
      keyboardHint - optional keyboard shortcut hint (e.g., "Ctrl+O")
    • setTextFieldAccessibility

      public static void setTextFieldAccessibility(javafx.scene.control.TextField field, String label, String placeholder, String help)
      Sets an accessible label and tooltip for a text field. Provides context for screen reader users.
      Parameters:
      field - the text field to configure
      label - the label text
      placeholder - placeholder text shown in empty field
      help - help text describing what the field accepts
    • setCheckBoxAccessibility

      public static void setCheckBoxAccessibility(javafx.scene.control.CheckBox checkBox, String label, String help)
      Sets an accessible label and tooltip for a checkbox. Makes the checkbox's state clearly announceable.
      Parameters:
      checkBox - the checkbox to configure
      label - the label text
      help - help text describing what toggling does
    • setLabelAccessibility

      public static void setLabelAccessibility(javafx.scene.control.Label label, String text, String role)
      Sets an accessible label for a Label control. Used for section headers and descriptive text.
      Parameters:
      label - the Label to configure
      text - the label text
      role - the semantic role (e.g., "Section heading", "Description")
    • setTextAccessibility

      public static void setTextAccessibility(javafx.scene.text.Text textNode, String text, String role)
      Sets accessibility metadata for a Text node. Useful when using Text for richer styling (e.g., strikethrough).
      Parameters:
      textNode - the Text node to configure
      text - the textual content
      role - semantic role description
    • requestFocusAccessible

      public static void requestFocusAccessible(javafx.scene.control.Control control, String announcement)
      Requests focus on a control and announces it to screen readers. Used when programmatically shifting focus (e.g., after file load).
      Parameters:
      control - the control to focus
      announcement - optional announcement text for screen readers
    • announceStatus

      public static void announceStatus(String message)
      Announces a status change to screen readers via logging. Screen reader applications can monitor logs or use system announcements.
      Parameters:
      message - the message to announce
    • announceAction

      public static void announceAction(String action)
      Announces a dialog action (button pressed, validation error, etc.) to screen readers.
      Parameters:
      action - the action that occurred (e.g., "File loaded", "Error: Invalid input")
    • announceHelp

      public static void announceHelp(String controlName, String helpText)
      Announces help text for the currently focused control.
      Parameters:
      controlName - the name of the control
      helpText - the help text to announce
    • setRequired

      public static void setRequired(javafx.scene.control.Control control, boolean required)
      Marks a control as requiring input (validation indicator for screen readers).
      Parameters:
      control - the control
      required - whether the field is required
    • setKeyboardShortcut

      public static void setKeyboardShortcut(javafx.scene.control.Control control, String shortcut)
      Configures keyboard shortcut accessibility info for a control. Helps screen reader users discover keyboard alternatives.
      Parameters:
      control - the control
      shortcut - the keyboard shortcut (e.g., "Ctrl+S for Save")
    • announceModeChange

      public static void announceModeChange(String mode, String instructions)
      Creates a focused announcement for mode changes (e.g., entering calibration mode). This helps screen reader users understand the current context.
      Parameters:
      mode - the mode name (e.g., "Calibration Mode")
      instructions - the instructions for this mode
    • announceProgress

      public static void announceProgress(String label, int current, int total)
      Announces numerical feedback to screen readers (e.g., point counts, calibration progress).
      Parameters:
      label - what is being counted (e.g., "Calibration points")
      current - the current count
      total - the total expected
    • announceCoordinates

      public static void announceCoordinates(String description, double xValue, double yValue)
      Announces coordinate or value information to screen readers. Used for providing feedback on canvas interactions.
      Parameters:
      description - what the values represent
      xValue - the x value
      yValue - the y value
    • announceColor

      public static void announceColor(String datasetName, String colorHex, String colorName)
      Announces color information in accessible format. Screen reader users can't distinguish colors, so describe them.
      Parameters:
      datasetName - the name of the dataset
      colorHex - the hex color code (e.g., "#0072B2")
      colorName - accessible description (e.g., "Blue")
    • getOSTextScaling

      public static double getOSTextScaling()
      Gets the OS text scaling factor (Windows DPI scaling). Returns 1.0 for 100% scaling, 1.25 for 125%, 1.5 for 150%, etc.
      Returns:
      the text scaling factor