Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8239902: Remove direct usage of JSlider, JProgressBar classes in CAcc…
…essible class

Reviewed-by: serb
  • Loading branch information
Pankaj Bansal committed Mar 3, 2020
1 parent c2867d6 commit 23def435d4a311bcf42438ad98e1f4d1e5f8aab8
Showing with 8 additions and 13 deletions.
  1. +8 −13 src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java
@@ -44,6 +44,7 @@
import static javax.accessibility.AccessibleContext.ACCESSIBLE_TABLE_MODEL_CHANGED;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_NAME_PROPERTY;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_VALUE_PROPERTY;

import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
@@ -106,13 +107,6 @@ public void addNotificationListeners(Component c) {
AccessibleContext ac = ((Accessible)c).getAccessibleContext();
ac.addPropertyChangeListener(new AXChangeNotifier());
}
if (c instanceof JProgressBar) {
JProgressBar pb = (JProgressBar) c;
pb.addChangeListener(new AXProgressChangeNotifier());
} else if (c instanceof JSlider) {
JSlider slider = (JSlider) c;
slider.addChangeListener(new AXProgressChangeNotifier());
}
}

private class AXChangeNotifier implements PropertyChangeListener {
@@ -173,17 +167,18 @@ public void propertyChange(PropertyChangeEvent e) {
if (e.getSource() instanceof JTabbedPane) {
titleChanged(ptr);
}
} else if (name.compareTo(ACCESSIBLE_VALUE_PROPERTY) == 0) {
AccessibleRole thisRole = accessible.getAccessibleContext()
.getAccessibleRole();
if (thisRole == AccessibleRole.SLIDER ||
thisRole == AccessibleRole.PROGRESS_BAR) {
valueChanged(ptr);
}
}
}
}
}

private class AXProgressChangeNotifier implements ChangeListener {
@Override
public void stateChanged(ChangeEvent e) {
if (ptr != 0) valueChanged(ptr);
}
}

static Accessible getSwingAccessible(final Accessible a) {
return (a instanceof CAccessible) ? ((CAccessible)a).accessible : a;

0 comments on commit 23def43

Please sign in to comment.