use of javax.accessibility.AccessibleContext in project jdk8u_jdk by JetBrains.
the class BasicComboPopup method getAccessibleContext.
//
// end Autoscroll methods
//=================================================================
//===================================================================
// begin Utility methods
//
/**
* Gets the AccessibleContext associated with this BasicComboPopup.
* The AccessibleContext will have its parent set to the ComboBox.
*
* @return an AccessibleContext for the BasicComboPopup
* @since 1.5
*/
public AccessibleContext getAccessibleContext() {
AccessibleContext context = super.getAccessibleContext();
context.setAccessibleParent(comboBox);
return context;
}
use of javax.accessibility.AccessibleContext in project jdk8u_jdk by JetBrains.
the class bug6986385 method main.
public static void main(String... args) throws Exception {
JLayer l = new JLayer();
AccessibleContext acc = l.getAccessibleContext();
if (acc == null) {
throw new RuntimeException("JLayer's AccessibleContext is null");
}
if (acc.getAccessibleRole() != AccessibleRole.PANEL) {
throw new RuntimeException("JLayer's AccessibleRole must be PANEL");
}
}
use of javax.accessibility.AccessibleContext in project jdk8u_jdk by JetBrains.
the class Bug8154069 method main.
public static void main(String[] args) throws Exception {
try {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
} catch (Exception e) {
throw new RuntimeException(e);
}
SwingUtilities.invokeAndWait(() -> {
frame = new JFrame();
String[] petStrings = { "Bird", "Cat" };
JComboBox<String> cb = new JComboBox<>(petStrings);
// select Cat
cb.setSelectedIndex(1);
frame.add(cb);
frame.pack();
try {
cb.setSelectedIndex(-1);
int i = cb.getSelectedIndex();
if (i != -1) {
throw new RuntimeException("getSelectedIndex is not -1");
}
Object o = cb.getSelectedItem();
if (o != null) {
throw new RuntimeException("getSelectedItem is not null");
}
AccessibleContext ac = cb.getAccessibleContext();
AccessibleSelection as = ac.getAccessibleSelection();
int count = as.getAccessibleSelectionCount();
if (count != 0) {
throw new RuntimeException("getAccessibleSelection count is not 0");
}
Accessible a = as.getAccessibleSelection(0);
if (a != null) {
throw new RuntimeException("getAccessibleSelection(0) is not null");
}
} catch (Exception e) {
exception = e;
}
});
if (exception != null) {
System.out.println("Test failed: " + exception.getMessage());
throw exception;
} else {
System.out.println("Test passed.");
}
} finally {
SwingUtilities.invokeAndWait(() -> {
frame.dispose();
});
}
}
Aggregations