summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorOliver Braun <obr@openoffice.org>2002-12-06 11:55:17 +0000
committerOliver Braun <obr@openoffice.org>2002-12-06 11:55:17 +0000
commit3fbcdc4597bafa025a8cc05791fa4b2fadee9d66 (patch)
treee07a41221fd4f73672eed5af52b5c587362c5d9f /accessibility
parentaa37230b1f4da7a052a5ab9792f0f75d2b4d09b6 (diff)
#100456# fixed population of menus
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Menu.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java
index dab01ba7c99a..9c27e382f266 100644
--- a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java
@@ -2,9 +2,9 @@
*
* $RCSfile: Menu.java,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: obr $ $Date: 2002-12-06 11:25:37 $
+ * last change: $Author: obr $ $Date: 2002-12-06 12:55:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,13 +87,16 @@ public class Menu extends AbstractButton implements javax.accessibility.Accessib
children = new java.util.Vector(count);
// Fill the vector with objects
AccessibleObjectFactory factory = AccessibleObjectFactory.getDefault();
- for (int i=0; i < children.size(); i++) {
+ for (int i=0; i < count; i++) {
java.awt.Component c = getComponent(unoAccessibleContext.getAccessibleChild(i));
if (c != null) {
children.add(c);
}
}
} catch (com.sun.star.uno.RuntimeException e) {
+ if (Build.DEBUG) {
+ System.err.println("RuntimeException caught during menu initialization: " + e.getMessage());
+ }
if (children == null) {
children = new java.util.Vector(0);
}
@@ -236,7 +239,15 @@ public class Menu extends AbstractButton implements javax.accessibility.Accessib
/** Returns the specified Accessible child of the object */
public synchronized javax.accessibility.Accessible getAccessibleChild(int i) {
- return (javax.accessibility.Accessible) children.get(i);
+ try {
+ if (i < children.size()) {
+ return (javax.accessibility.Accessible) children.get(i);
+ } else {
+ return null;
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
}
/** Returns the AccessibleSelection interface for this object */