private static void assertGetLocation() {
    // the frame is now invisible
    // test getLocationOnScreen() of
    // JTable$AccessibleJTable$AccessibleJTableHeaderCell
    // and JTable$AccessibleJTable$AccessibleJTableCell
    AccessibleTable accessibleTable = (AccessibleTable) table.getAccessibleContext();
    AccessibleTable header = accessibleTable.getAccessibleColumnHeader();
    AccessibleComponent accessibleComp1 = (AccessibleComponent) header.getAccessibleAt(0, 0);
    // getLocation() must be null according to its javadoc and no exception
    // is thrown
    if (null != accessibleComp1.getLocationOnScreen()) {
      throw new RuntimeException(
          "JTable$AccessibleJTable$AccessibleJTableHeaderCell." + "getLocation() must be null");
    }

    JComponent.AccessibleJComponent accessibleJComponent =
        (JComponent.AccessibleJComponent) table.getAccessibleContext();
    AccessibleComponent accessibleComp2 =
        (AccessibleComponent) accessibleJComponent.getAccessibleChild(3);
    // getLocation() must be null according to its javadoc and no exception
    // is thrown
    if (null != accessibleComp2.getLocationOnScreen()) {
      throw new RuntimeException(
          "JTable$AccessibleJTable$" + "AccessibleJTableCell.getLocation() must be null");
    }
  }
Ejemplo n.º 2
0
  public static Accessible getAccessibleAt(final Component component, final Point point) {
    Accessible result = null;

    if (component == null) {
      return null;
    }
    AccessibleContext context = component.getAccessibleContext();
    if (context == null) {
      return null;
    }
    AccessibleComponent accessibleComponent = context.getAccessibleComponent();
    if (accessibleComponent == null) {
      return null;
    }

    return accessibleComponent.getAccessibleAt(point);
  }