@Override public int getAccessibleIndexInParent() { toolkit.lockAWT(); try { Accessible aParent = getAccessibleParent(); int aIndex = -1; if (aParent instanceof MenuComponent) { MenuComponent parent = (MenuComponent) aParent; int count = parent.getItemCount(); for (int i = 0; i < count; i++) { MenuComponent comp = parent.getItem(i); if (comp instanceof Accessible) { aIndex++; if (comp == MenuComponent.this) { return aIndex; } } } } return -1; } finally { toolkit.unlockAWT(); } }
void hide() { selectedItemIndex = -1; if (parent instanceof MenuComponent) { ((MenuComponent) parent).itemHidden(this); } }