javax.accessibility.AccessibleContext Java Examples
The following examples show how to use
javax.accessibility.AccessibleContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CAccessibleText.java From jdk8u_jdk with GNU General Public License v2.0 | 12 votes |
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount()); if (!validRange) return; aet.selectText(startIndex, endIndex); } }, c); }
Example #2
Source File: CAccessibleText.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount()); if (!validRange) return; aet.selectText(startIndex, endIndex); } }, c); }
Example #3
Source File: ProfilerWindow.java From visualvm with GNU General Public License v2.0 | 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 #4
Source File: CAccessibleText.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
static void setSelectedText(final Accessible a, final Component c, final String newText) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final int selectionStart = aet.getSelectionStart(); final int selectionEnd = aet.getSelectionEnd(); aet.replaceText(selectionStart, selectionEnd, newText); } }, c); }
Example #5
Source File: TextPanel.java From consulo with Apache License 2.0 | 6 votes |
public final void setText(@Nullable String text) { text = StringUtil.notNullize(text); if (text.equals(myText)) { return; } String oldAccessibleName = null; if (accessibleContext != null) { oldAccessibleName = accessibleContext.getAccessibleName(); } myText = text; if ((accessibleContext != null) && !StringUtil.equals(accessibleContext.getAccessibleName(), oldAccessibleName)) { accessibleContext.firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, oldAccessibleName, accessibleContext.getAccessibleName()); } setPreferredSize(getPanelDimensionFromFontMetrics(myText)); revalidate(); repaint(); }
Example #6
Source File: CAccessibleText.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static void setSelectedText(final Accessible a, final Component c, final String newText) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final int selectionStart = aet.getSelectionStart(); final int selectionEnd = aet.getSelectionEnd(); aet.replaceText(selectionStart, selectionEnd, newText); } }, c); }
Example #7
Source File: JComponentOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public Hashtable<String, Object> getDump() { Hashtable<String, Object> result = super.getDump(); if (getToolTipText() != null) { result.put(TOOLTIP_TEXT_DPROP, getToolTipText()); } //System.out.println("Dump a11y = " + System.getProperty("jemmy.dump.a11y")); if (System.getProperty("jemmy.dump.a11y") != null && System.getProperty("jemmy.dump.a11y").equals("on")) { AccessibleContext a11y = getSource().getAccessibleContext(); if (a11y != null) { result.put(A11Y_DATA, "yes"); String accName = (a11y.getAccessibleName() == null) ? "null" : a11y.getAccessibleName(); String accDesc = (a11y.getAccessibleDescription() == null) ? "null" : a11y.getAccessibleDescription(); result.put(A11Y_NAME_DPROP, accName); result.put(A11Y_DESCRIPTION_DPROP, accDesc); } else { result.put(A11Y_DATA, "no"); } } return result; }
Example #8
Source File: TableDemo.java From Darcula with Apache License 2.0 | 6 votes |
/** * Sets the Accessibility MEMBER_OF property to denote that * these components work together as a group. Each object * is set to be a MEMBER_OF an array that contains all of * the objects in the group, including itself. * * @param components The list of objects that are related */ void buildAccessibleGroup(Vector components) { AccessibleContext context = null; int numComponents = components.size(); Object[] group = components.toArray(); Object object = null; for (int i = 0; i < numComponents; ++i) { object = components.elementAt(i); if (object instanceof Accessible) { context = ((Accessible)components.elementAt(i)). getAccessibleContext(); context.getAccessibleRelationSet().add( new AccessibleRelation( AccessibleRelation.MEMBER_OF, group)); } } }
Example #9
Source File: CAccessibleText.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static void setSelectedText(final Accessible a, final Component c, final String newText) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final int selectionStart = aet.getSelectionStart(); final int selectionEnd = aet.getSelectionEnd(); aet.replaceText(selectionStart, selectionEnd, newText); } }, c); }
Example #10
Source File: CAccessibleText.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount()); if (!validRange) return; aet.selectText(startIndex, endIndex); } }, c); }
Example #11
Source File: BasicAbstractResultsPanel.java From netbeans with Apache License 2.0 | 6 votes |
private void initAccessibility() { ResourceBundle bundle = NbBundle.getBundle(ResultView.class); AccessibleContext accessCtx; OutlineView outlineView = resultsOutlineSupport.getOutlineView(); accessCtx = outlineView.getHorizontalScrollBar().getAccessibleContext(); accessCtx.setAccessibleName( bundle.getString("ACSN_HorizontalScrollbar")); //NOI18N accessCtx = outlineView.getVerticalScrollBar().getAccessibleContext(); accessCtx.setAccessibleName( bundle.getString("ACSN_VerticalScrollbar")); //NOI18N accessCtx = outlineView.getAccessibleContext(); accessCtx.setAccessibleName( bundle.getString("ACSN_ResultTree")); //NOI18N accessCtx.setAccessibleDescription( bundle.getString("ACSD_ResultTree")); //NOI18N }
Example #12
Source File: CAccessibleText.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount()); if (!validRange) return; aet.selectText(startIndex, endIndex); } }, c); }
Example #13
Source File: CAccessibleText.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static int[] getSelectedTextRange(final Accessible a, final Component c) { if (a == null) return new int[2]; return CAccessibility.invokeAndWait(new Callable<int[]>() { public int[] call() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return new int[2]; final AccessibleText at = ac.getAccessibleText(); if (at == null) return new int[2]; final int[] ret = new int[2]; ret[0] = at.getSelectionStart(); ret[1] = at.getSelectionEnd(); return ret; } }, c); }
Example #14
Source File: ClickableLinkTickerRenderer.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
protected String getLink(Point p) { final AccessibleContext aC = getAccessibleContext(); if (aC instanceof AccessibleJLabel) { final AccessibleJLabel aL = (AccessibleJLabel) aC; final AccessibleText aT = aL.getAccessibleText(); if (aT == null) { return null; } final int index = aL.getIndexAtPoint(p); for (final LinkDescriptor entry : listLinks) { if (index >= entry.getStart() && index <= entry.getEnd()) { return entry.getUrl(); } } } return null; }
Example #15
Source File: CAccessibleText.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount()); if (!validRange) return; aet.selectText(startIndex, endIndex); } }, c); }
Example #16
Source File: CAccessibleText.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) { if (a == null) return; CAccessibility.invokeLater(new Runnable() { public void run() { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return; final AccessibleEditableText aet = ac.getAccessibleEditableText(); if (aet == null) return; final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount()); if (!validRange) return; aet.selectText(startIndex, endIndex); } }, c); }
Example #17
Source File: JTabbedPane.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Sets the tooltip text at <code>index</code> to <code>toolTipText</code> * which can be <code>null</code>. * An internal exception is raised if there is no tab at that index. * * @param index the tab index where the tooltip text should be set * @param toolTipText the tooltip text to be displayed for the tab * @exception IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getToolTipTextAt * @since 1.3 */ @BeanProperty(preferred = true, description = "The tooltip text at the specified tab index.") public void setToolTipTextAt(int index, String toolTipText) { String oldToolTipText = pages.get(index).tip; pages.get(index).tip = toolTipText; if ((oldToolTipText != toolTipText) && (accessibleContext != null)) { accessibleContext.firePropertyChange( AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, oldToolTipText, toolTipText); } if (!haveRegistered && toolTipText != null) { ToolTipManager.sharedInstance().registerComponent(this); haveRegistered = true; } }
Example #18
Source File: CAccessibleText.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static AccessibleEditableText getAccessibleEditableText(final Accessible a, final Component c) { if (a == null) return null; return CAccessibility.invokeAndWait(new Callable<AccessibleEditableText>() { public AccessibleEditableText call() throws Exception { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; return ac.getAccessibleEditableText(); } }, c); }
Example #19
Source File: BasicInternalFrameTitlePane.java From JDKSourceCode1.8 with MIT License | 5 votes |
public AccessibleContext getAccessibleContext() { AccessibleContext ac = super.getAccessibleContext(); if (uiKey != null) { ac.setAccessibleName(UIManager.getString(uiKey)); uiKey = null; } return ac; }
Example #20
Source File: BasicInternalFrameTitlePane.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public AccessibleContext getAccessibleContext() { AccessibleContext ac = super.getAccessibleContext(); if (uiKey != null) { ac.setAccessibleName(UIManager.getString(uiKey)); uiKey = null; } return ac; }
Example #21
Source File: CAccessibleText.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static AccessibleEditableText getAccessibleEditableText(final Accessible a, final Component c) { if (a == null) return null; return CAccessibility.invokeAndWait(new Callable<AccessibleEditableText>() { public AccessibleEditableText call() throws Exception { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; return ac.getAccessibleEditableText(); } }, c); }
Example #22
Source File: CAccessible.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void addNotificationListeners(Component c) { if (c instanceof Accessible) { 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()); } }
Example #23
Source File: CAccessibleText.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static String getSelectedText(final Accessible a, final Component c) { if (a == null) return null; return CAccessibility.invokeAndWait(new Callable<String>() { public String call() throws Exception { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; final AccessibleText at = ac.getAccessibleText(); if (at == null) return null; return at.getSelectedText(); } }, c); }
Example #24
Source File: CAccessibleText.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static double[] getBoundsForRange(final Accessible a, final Component c, final int location, final int length) { final double[] ret = new double[4]; if (a == null) return ret; return CAccessibility.invokeAndWait(new Callable<double[]>() { public double[] call() throws Exception { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return ret; final AccessibleText at = ac.getAccessibleText(); if (at == null) { ac.getAccessibleName(); ac.getAccessibleEditableText(); return ret; } final Rectangle2D boundsStart = at.getCharacterBounds(location); final Rectangle2D boundsEnd = at.getCharacterBounds(location + length - 1); if (boundsEnd == null || boundsStart == null) return ret; final Rectangle2D boundsUnion = boundsStart.createUnion(boundsEnd); if (boundsUnion.isEmpty()) return ret; final double localX = boundsUnion.getX(); final double localY = boundsUnion.getY(); final Point componentLocation = ac.getAccessibleComponent().getLocationOnScreen(); if (componentLocation == null) return ret; final double screenX = componentLocation.getX() + localX; final double screenY = componentLocation.getY() + localY; ret[0] = screenX; ret[1] = screenY; // in java screen coords (from top-left corner of screen) ret[2] = boundsUnion.getWidth(); ret[3] = boundsUnion.getHeight(); return ret; } }, c); }
Example #25
Source File: MultiIconSimpleColoredComponent.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleSimpleColoredComponent(); } return accessibleContext; }
Example #26
Source File: CAccessibleText.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static String getSelectedText(final Accessible a, final Component c) { if (a == null) return null; return CAccessibility.invokeAndWait(new Callable<String>() { public String call() throws Exception { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; final AccessibleText at = ac.getAccessibleText(); if (at == null) return null; return at.getSelectedText(); } }, c); }
Example #27
Source File: SeparatorWithText.java From consulo with Apache License 2.0 | 5 votes |
@Override public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleSeparatorWithText(); } return accessibleContext; }
Example #28
Source File: bug4743225.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static BasicComboPopup getPopup() { AccessibleContext c = cb.getAccessibleContext(); for(int i = 0; i < c.getAccessibleChildrenCount(); i ++) { if (c.getAccessibleChild(i) instanceof BasicComboPopup) { return (BasicComboPopup) c.getAccessibleChild(i); } } throw new AssertionError("No BasicComboPopup found"); }
Example #29
Source File: CAccessible.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void addNotificationListeners(Component c) { if (c instanceof Accessible) { 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()); } }
Example #30
Source File: CAccessibleText.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static AccessibleEditableText getAccessibleEditableText(final Accessible a, final Component c) { if (a == null) return null; return CAccessibility.invokeAndWait(new Callable<AccessibleEditableText>() { public AccessibleEditableText call() throws Exception { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; return ac.getAccessibleEditableText(); } }, c); }