Skip to content

Commit

Permalink
Add in accessibility support for screen readers:
Browse files Browse the repository at this point in the history
   ContributedLibraryTableCellJPanel.java: Add description to accessibility context
   ContributedPlatformTableCellJPanel.java: Add description to accessibility context

   ProgressJProgressBar.java:
      Add status to accessibility context
      make progress bar focusable so screen reader can access
  • Loading branch information
Joe Wegner committed Aug 15, 2019
1 parent 452ac63 commit 6bcd052
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,

desc += "</body></html>";
description.setText(desc);
// copy description to accessibility context for screen readers to use
description.getAccessibleContext().setAccessibleDescription(desc);
description.setBackground(Color.WHITE);

// for modelToView to work, the text area has to be sized. It doesn't
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ void update(JTable parentTable, Object value, boolean isSelected,

desc += "</body></html>";
description.setText(desc);
// copy description to accessibility context for screen readers to use
description.getAccessibleContext().setAccessibleDescription(desc);
description.setBackground(Color.WHITE);

// for modelToView to work, the text area has to be sized. It doesn't
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ public class ProgressJProgressBar extends JProgressBar {

public void setValue(Progress p) {
setValue((int) p.getProgress());
if (p.getStatus() != null)
if (p.getStatus() != null) {
setString(p.getStatus());
// copy status to accessibility context for screen readers to use
getAccessibleContext().setAccessibleDescription(p.getStatus());
// make status focusable so screen readers can get to it
setFocusable(true);
}
}

}

0 comments on commit 6bcd052

Please sign in to comment.