Java Code Examples for javax.swing.JComponent.AccessibleJComponent

The following are Jave code examples for showing how to use AccessibleJComponent of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ProfilerWindow.java   View Source Code Vote up 6 votes
public AccessibleContext getAccessibleContext() {
    if (accessibleContext == null) {
        accessibleContext = new JComponent.AccessibleJComponent() {
            public AccessibleRole getAccessibleRole() {
                return AccessibleRole.PANEL;
            }

            public String getAccessibleName() {
                return Bundle.ProfilerWindow_accessName(getDisplayName());
            }

            public String getAccessibleDescription() {
                ProfilerFeature selected = featuresView == null ? null :
                                featuresView.getSelectedFeature();
                return selected == null ? WelcomePanel.CAPTION :
                       (selected.getName() + " " + selected.getDescription()); // NOI18N
            }
        };
    }
    return accessibleContext;
}
 
Example 2
Project: incubator-netbeans   File: BaseRenderer.java   View Source Code Vote up 5 votes
protected AccessibleContext createAccesibleContext() {
    return new JComponent.AccessibleJComponent() {
        public AccessibleRole getAccessibleRole() {
            return AccessibleRole.LABEL;
        }
        public String getAccessibleName() {
            return BaseRenderer.this.toString();
        }
    };
}
 
Example 3
Project: jdk8u-jdk   File: JTableAccessibleGetLocationOnScreen.java   View Source Code Vote up 5 votes
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");
    }

}
 
Example 4
Project: openjdk-jdk10   File: JTableAccessibleGetLocationOnScreen.java   View Source Code Vote up 5 votes
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");
    }

}
 
Example 5
Project: incubator-netbeans   File: ProfilerTreeTable.java   View Source Code Vote up 4 votes
public AccessibleContext getAccessibleContext() {
    TreeCellRenderer renderer = getCellRenderer();
    return renderer instanceof Accessible ?
           ((Accessible)renderer).getAccessibleContext() :
           new JComponent.AccessibleJComponent() {};
}