AccessibleAction () { if (myAction == null) { myAction = new AccessibleAction() { @Override public int getAccessibleActionCount() { AccessibleContext ac = getDelegate(); AccessibleAction aa = ac.getAccessibleAction(); return aa != null ? aa.getAccessibleActionCount() + 1 : 1; } @Override public String getAccessibleActionDescription(int i) { if (i < 0 || i > getAccessibleActionCount()) return null; if (getAccessibleActionCount() != 1 && i < getAccessibleActionCount() - 1) { return getDelegate().getAccessibleAction().getAccessibleActionDescription(i); } return AccessibleAction.TOGGLE_POPUP; } @Override public boolean doAccessibleAction(int i) { if (i < 0 || i > getAccessibleActionCount()) return false; if (getAccessibleActionCount() != 1 && i < getAccessibleActionCount() - 1) { return getDelegate().getAccessibleAction().doAccessibleAction(i); } doShowContextMenu(); return true; } }; } return myAction; }