/[classpath]/classpath/java/awt/Container.java
ViewVC logotype

Diff of /classpath/java/awt/Container.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by tromey, Mon Nov 11 06:32:47 2002 UTC revision 1.14 by mkoch, Mon Dec 23 12:45:46 2002 UTC
# Line 59  import javax.accessibility.Accessible; Line 59  import javax.accessibility.Accessible;
59   *   *
60   * @author original author unknown   * @author original author unknown
61   * @author Eric Blake <ebb9@email.byu.edu>   * @author Eric Blake <ebb9@email.byu.edu>
62     *
63   * @since 1.0   * @since 1.0
64     *
65   * @status still missing 1.4 support   * @status still missing 1.4 support
66   */   */
67  public class Container extends Component  public class Container extends Component
# Line 78  public class Container extends Component Line 80  public class Container extends Component
80    
81    Dimension maxSize;    Dimension maxSize;
82    
83    /** @since 1.4 */    /**
84       * @since 1.4
85       */
86    boolean focusCycleRoot;    boolean focusCycleRoot;
87    
88    int containerSerializedDataVersion;    int containerSerializedDataVersion;
# Line 107  public class Container extends Component Line 111  public class Container extends Component
111     * Returns the number of components in this container.     * Returns the number of components in this container.
112     *     *
113     * @return The number of components in this container.     * @return The number of components in this container.
114       *
115     * @deprecated use {@link #getComponentCount()} instead     * @deprecated use {@link #getComponentCount()} instead
116     */     */
117    public int countComponents()    public int countComponents()
# Line 118  public class Container extends Component Line 123  public class Container extends Component
123     * Returns the component at the specified index.     * Returns the component at the specified index.
124     *     *
125     * @param index The index of the component to retrieve.     * @param index The index of the component to retrieve.
126       *
127     * @return The requested component.     * @return The requested component.
128       *
129     * @throws ArrayIndexOutOfBoundsException If the specified index is invalid     * @throws ArrayIndexOutOfBoundsException If the specified index is invalid
130     */     */
131    public Component getComponent(int n)    public Component getComponent(int n)
132    {    {
133      synchronized (getTreeLock ())      synchronized (getTreeLock ())
134        {        {
135          if (n < 0 || n >= ncomponents)          if (n < 0 || n >= ncomponents)
136            throw new ArrayIndexOutOfBoundsException("no such component");            throw new ArrayIndexOutOfBoundsException("no such component");
137          return component[n];  
138            return component[n];
139        }        }
140    }    }
141    
# Line 140  public class Container extends Component Line 148  public class Container extends Component
148    {    {
149      synchronized (getTreeLock ())      synchronized (getTreeLock ())
150        {        {
151          Component[] result = new Component[ncomponents];          Component[] result = new Component[ncomponents];
152          if (ncomponents > 0)  
153            System.arraycopy(component, 0, result, 0, ncomponents);          if (ncomponents > 0)
154          return result;            System.arraycopy(component, 0, result, 0, ncomponents);
155    
156            return result;
157        }        }
158    }    }
159    
# Line 157  public class Container extends Component Line 167  public class Container extends Component
167    {    {
168      if (peer == null)      if (peer == null)
169        return new Insets(0, 0, 0, 0);        return new Insets(0, 0, 0, 0);
170        
171      return ((ContainerPeer) peer).getInsets();      return ((ContainerPeer) peer).getInsets();
172    }    }
173    
# Line 177  public class Container extends Component Line 188  public class Container extends Component
188     * component list.     * component list.
189     *     *
190     * @param component The component to add to the container.     * @param component The component to add to the container.
191       *
192     * @return The same component that was added.     * @return The same component that was added.
193     */     */
194    public Component add(Component comp)    public Component add(Component comp)
# Line 190  public class Container extends Component Line 202  public class Container extends Component
202     * component list.  This method should not be used. Instead, use     * component list.  This method should not be used. Instead, use
203     * <code>add(Component, Object</code>.     * <code>add(Component, Object</code>.
204     *     *
205     * @param name FIXME     * @param name The name of the component to be added.
206     * @param component The component to be added.     * @param component The component to be added.
207     *     *
208     * @return The same component that was added.     * @return The same component that was added.
# Line 268  public class Container extends Component Line 280  public class Container extends Component
280    {    {
281      synchronized (getTreeLock ())      synchronized (getTreeLock ())
282        {        {
283          if (index > ncomponents          if (index > ncomponents
284              || (index < 0 && index != -1)              || (index < 0 && index != -1)
285              || comp instanceof Window              || comp instanceof Window
286              || (comp instanceof Container              || (comp instanceof Container
287                  && ((Container) comp).isAncestorOf(this)))                  && ((Container) comp).isAncestorOf(this)))
288            throw new IllegalArgumentException();            throw new IllegalArgumentException();
289    
290          // Reparent component, and make sure component is instantiated if          // Reparent component, and make sure component is instantiated if
291          // we are.          // we are.
292          if (comp.parent != null)          if (comp.parent != null)
293            comp.parent.remove(comp);            comp.parent.remove(comp);
294          comp.parent = this;          comp.parent = this;
295          if (peer != null)          if (peer != null)
296            {            {
297              comp.addNotify();              comp.addNotify();
298    
299              if (comp.isLightweight())              if (comp.isLightweight())
300                enableEvents(comp.eventMask);                enableEvents(comp.eventMask);
301            }            }
302    
303          invalidate();          invalidate();
304    
305          if (component == null)          if (component == null)
306            component = new Component[4]; // FIXME, better initial size?            component = new Component[4]; // FIXME, better initial size?
307    
308          // This isn't the most efficient implementation.  We could do less          // This isn't the most efficient implementation.  We could do less
309          // copying when growing the array.  It probably doesn't matter.          // copying when growing the array.  It probably doesn't matter.
310          if (ncomponents >= component.length)          if (ncomponents >= component.length)
311            {            {
312              int nl = component.length * 2;              int nl = component.length * 2;
313              Component[] c = new Component[nl];              Component[] c = new Component[nl];
314              System.arraycopy(component, 0, c, 0, ncomponents);              System.arraycopy(component, 0, c, 0, ncomponents);
315              component = c;              component = c;
316            }            }
317          if (index == -1)    
318            component[ncomponents++] = comp;          if (index == -1)
319          else            component[ncomponents++] = comp;
320            {          else
321              System.arraycopy(component, index, component, index + 1,            {
322                               ncomponents - index);              System.arraycopy(component, index, component, index + 1,
323              component[index] = comp;                               ncomponents - index);
324              ++ncomponents;              component[index] = comp;
325            }              ++ncomponents;
326              }
327    
328          // Notify the layout manager.          // Notify the layout manager.
329          if (layoutMgr != null)          if (layoutMgr != null)
330            {            {
331              if (layoutMgr instanceof LayoutManager2)              if (layoutMgr instanceof LayoutManager2)
332                {                {
333                  LayoutManager2 lm2 = (LayoutManager2) layoutMgr;                  LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
334                  lm2.addLayoutComponent(comp, constraints);                  lm2.addLayoutComponent(comp, constraints);
335                }                }
336              else if (constraints instanceof String)              else if (constraints instanceof String)
337                layoutMgr.addLayoutComponent((String) constraints, comp);                layoutMgr.addLayoutComponent((String) constraints, comp);
338              else              else
339                layoutMgr.addLayoutComponent(null, comp);                layoutMgr.addLayoutComponent(null, comp);
340            }            }
341    
342          // Post event to notify of adding the container.          // Post event to notify of adding the container.
343          ContainerEvent ce = new ContainerEvent(this,          ContainerEvent ce = new ContainerEvent(this,
344                                                 ContainerEvent.COMPONENT_ADDED,                                                 ContainerEvent.COMPONENT_ADDED,
345                                                 comp);                                                 comp);
346          getToolkit().getSystemEventQueue().postEvent(ce);          getToolkit().getSystemEventQueue().postEvent(ce);
347        }        }
348    }    }
349    
# Line 343  public class Container extends Component Line 356  public class Container extends Component
356    {    {
357      synchronized (getTreeLock ())      synchronized (getTreeLock ())
358        {        {
359          Component r = component[index];          Component r = component[index];
360    
361          r.removeNotify();          r.removeNotify();
362    
363          System.arraycopy(component, index + 1, component, index,          System.arraycopy(component, index + 1, component, index,
364                           ncomponents - index - 1);                           ncomponents - index - 1);
365          component[--ncomponents] = null;          component[--ncomponents] = null;
366    
367          invalidate();          invalidate();
368    
369          if (layoutMgr != null)          if (layoutMgr != null)
370            layoutMgr.removeLayoutComponent(r);            layoutMgr.removeLayoutComponent(r);
371    
372          // Post event to notify of adding the container.          // Post event to notify of adding the container.
373          ContainerEvent ce = new ContainerEvent(this,          ContainerEvent ce = new ContainerEvent(this,
374                                                 ContainerEvent.COMPONENT_REMOVED,                                                 ContainerEvent.COMPONENT_REMOVED,
375                                                 r);                                                 r);
376          getToolkit().getSystemEventQueue().postEvent(ce);          getToolkit().getSystemEventQueue().postEvent(ce);
377        }        }
378    }    }
379    
# Line 373  public class Container extends Component Line 386  public class Container extends Component
386    {    {
387      synchronized (getTreeLock ())      synchronized (getTreeLock ())
388        {        {
389          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
390            {            {
391              if (component[i] == comp)              if (component[i] == comp)
392                {                {
393                  remove(i);                  remove(i);
394                  break;                  break;
395                }                }
396            }            }
397        }        }
398    }    }
399    
# Line 391  public class Container extends Component Line 404  public class Container extends Component
404    {    {
405      synchronized (getTreeLock ())      synchronized (getTreeLock ())
406        {        {
407          while (ncomponents > 0)          while (ncomponents > 0)
408            remove(0);            remove(0);
409        }        }
410    }    }
411    
# Line 525  public class Container extends Component Line 538  public class Container extends Component
538     * Returns the preferred size of this container.     * Returns the preferred size of this container.
539     *     *
540     * @return The preferred size of this container.     * @return The preferred size of this container.
541       *
542     * @deprecated use {@link #getPreferredSize()} instead     * @deprecated use {@link #getPreferredSize()} instead
543     */     */
544    public Dimension preferredSize()    public Dimension preferredSize()
# Line 549  public class Container extends Component Line 563  public class Container extends Component
563     * Returns the minimum size of this container.     * Returns the minimum size of this container.
564     *     *
565     * @return The minimum size of this container.     * @return The minimum size of this container.
566       *
567     * @deprecated use {@link #getMinimumSize()} instead     * @deprecated use {@link #getMinimumSize()} instead
568     */     */
569    public Dimension minimumSize()    public Dimension minimumSize()
# Line 709  public class Container extends Component Line 724  public class Container extends Component
724    }    }
725    
726    /**    /**
727       * Returns an array of all the objects currently registered as FooListeners
728       * upon this Container. FooListeners are registered using the addFooListener
729       * method.
730       *
731     * @since 1.3     * @since 1.3
732     */     */
733    public EventListener[] getListeners(Class listenerType)    public EventListener[] getListeners(Class listenerType)
# Line 760  public class Container extends Component Line 779  public class Container extends Component
779     * AWT 1.0 event processor.     * AWT 1.0 event processor.
780     *     *
781     * @param event The event that occurred.     * @param event The event that occurred.
782       *
783     * @deprecated use {@link #dispatchEvent(AWTEvent)} instead     * @deprecated use {@link #dispatchEvent(AWTEvent)} instead
784     */     */
785    public void deliverEvent(Event e)    public void deliverEvent(Event e)
# Line 784  public class Container extends Component Line 804  public class Container extends Component
804    {    {
805      synchronized (getTreeLock ())      synchronized (getTreeLock ())
806        {        {
807          if (! contains(x, y))          if (! contains(x, y))
808            return null;            return null;
809          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
810            {            {
811              // Ignore invisible children...              // Ignore invisible children...
812              if (!component[i].isVisible())              if (!component[i].isVisible())
813                continue;                continue;
814    
815              int x2 = x - component[i].x;              int x2 = x - component[i].x;
816              int y2 = y - component[i].y;              int y2 = y - component[i].y;
817              if (component[i].contains(x2, y2))              if (component[i].contains(x2, y2))
818                return component[i];                return component[i];
819            }            }
820          return this;          return this;
821        }        }
822    }    }
823    
# Line 813  public class Container extends Component Line 833  public class Container extends Component
833     *     *
834     * @return The component containing the specified point, or <code>null</code>     * @return The component containing the specified point, or <code>null</code>
835     * if there is no such point.     * if there is no such point.
836       *
837     * @deprecated use {@link #getComponentAt(int, int)} instead     * @deprecated use {@link #getComponentAt(int, int)} instead
838     */     */
839    public Component locate(int x, int y)    public Component locate(int x, int y)
# Line 841  public class Container extends Component Line 862  public class Container extends Component
862    {    {
863      synchronized (getTreeLock ())      synchronized (getTreeLock ())
864        {        {
865          if (! contains(x, y))          if (! contains(x, y))
866            return null;            return null;
867    
868          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
869            {            {
870              // Ignore invisible children...              // Ignore invisible children...
871              if (!component[i].isVisible())              if (!component[i].isVisible())
872                continue;                continue;
873    
874              int x2 = x - component[i].x;              int x2 = x - component[i].x;
875              int y2 = y - component[i].y;              int y2 = y - component[i].y;
876              // We don't do the contains() check right away because              // We don't do the contains() check right away because
877              // findComponentAt would redundantly do it first thing.              // findComponentAt would redundantly do it first thing.
878              if (component[i] instanceof Container)              if (component[i] instanceof Container)
879                {                {
880                  Container k = (Container) component[i];                  Container k = (Container) component[i];
881                  Component r = k.findComponentAt(x2, y2);                  Component r = k.findComponentAt(x2, y2);
882                  if (r != null)                  if (r != null)
883                    return r;                    return r;
884                }                }
885              else if (component[i].contains(x2, y2))              else if (component[i].contains(x2, y2))
886                return component[i];                return component[i];
887            }            }
888    
889          return this;          return this;
890        }        }
891    }    }
892    
# Line 894  public class Container extends Component Line 915  public class Container extends Component
915    {    {
916      synchronized (getTreeLock ())      synchronized (getTreeLock ())
917        {        {
918          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
919            component[i].removeNotify();            component[i].removeNotify();
920          super.removeNotify();          super.removeNotify();
921        }        }
922    }    }
923    
# Line 913  public class Container extends Component Line 934  public class Container extends Component
934    {    {
935      synchronized (getTreeLock ())      synchronized (getTreeLock ())
936        {        {
937          while (true)          while (true)
938            {            {
939              if (comp == null)              if (comp == null)
940                return false;                return false;
941              if (comp == this)              if (comp == this)
942                return true;                return true;
943              comp = comp.getParent();              comp = comp.getParent();
944            }            }
945        }        }
946    }    }
947    
# Line 950  public class Container extends Component Line 971  public class Container extends Component
971    {    {
972      synchronized (getTreeLock ())      synchronized (getTreeLock ())
973        {        {
974          super.list(out, indent);          super.list(out, indent);
975          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
976            component[i].list(out, indent + 2);            component[i].list(out, indent + 2);
977        }        }
978    }    }
979    
# Line 967  public class Container extends Component Line 988  public class Container extends Component
988    {    {
989      synchronized (getTreeLock ())      synchronized (getTreeLock ())
990        {        {
991          super.list(out, indent);          super.list(out, indent);
992          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
993            component[i].list(out, indent + 2);            component[i].list(out, indent + 2);
994        }        }
995    }    }
996    
997    public void setFocusTraversalKeys(int id, Set keys)    public void setFocusTraversalKeys(int id, Set keys)
998    {    {
999        if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
1000            id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
1001            id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
1002            id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
1003          throw new IllegalArgumentException ();
1004    }    }
1005      
1006    public Set getFocusTraversalKeys(int id)    public Set getFocusTraversalKeys(int id)
1007    {    {
1008        if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
1009            id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
1010            id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
1011            id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
1012          throw new IllegalArgumentException ();
1013    
1014      return null;      return null;
1015    }    }
1016      
1017    public boolean areFocusTraversalKeysSet(int id)    public boolean areFocusTraversalKeysSet(int id)
1018    {    {
1019        if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
1020            id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
1021            id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
1022            id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
1023          throw new IllegalArgumentException ();
1024    
1025      return false;      return false;
1026    }    }
1027      
1028    public boolean isFocusCycleRoot(Container c)    public boolean isFocusCycleRoot(Container c)
1029    {    {
1030      return false;      return false;
1031    }    }
1032      
1033    public void transferFocusBackward()    public void transferFocusBackward()
1034    {    {
1035    }    }
1036      
1037    public void setFocusTraversalPolicy(FocusTraversalPolicy policy)    public void setFocusTraversalPolicy(FocusTraversalPolicy policy)
1038    {    {
1039    }    }
1040      
1041    public FocusTraversalPolicy getFocusTraversalPolicy()    public FocusTraversalPolicy getFocusTraversalPolicy()
1042    {    {
1043      return null;      return null;
1044    }    }
1045      
1046    public boolean isFocusTraversalPolicySet()    public boolean isFocusTraversalPolicySet()
1047    {    {
1048      return false;      return false;
1049    }    }
1050      
1051    public void setFocusCycleRoot(boolean focusCycleRoot)    public void setFocusCycleRoot(boolean focusCycleRoot)
1052    {    {
1053    }    }
1054      
1055    public boolean isFocusCycleRoot()    public boolean isFocusCycleRoot()
1056    {    {
1057      return false;      return false;
1058    }    }
1059      
1060    public void transferFocusDownCycle()    public void transferFocusDownCycle()
1061    {    {
1062    }    }
1063      
1064    public void applyComponentOrientation(ComponentOrientation o)    public void applyComponentOrientation(ComponentOrientation o)
1065    {    {
1066        if (orientation == null)
1067          throw new NullPointerException ();
1068    }    }
1069      
1070    public void addPropertyChangeListener(PropertyChangeListener l)    public void addPropertyChangeListener(PropertyChangeListener l)
1071    {    {
1072    }    }
1073      
1074    public void addPropertyChangeListener(String name, PropertyChangeListener l)    public void addPropertyChangeListener(String name, PropertyChangeListener l)
1075    {    {
1076    }    }
1077    
   
1078    // Hidden helper methods.    // Hidden helper methods.
1079    
1080    /**    /**
# Line 1044  public class Container extends Component Line 1096  public class Container extends Component
1096    {    {
1097      synchronized (getTreeLock ())      synchronized (getTreeLock ())
1098        {        {
1099          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
1100            {            {
1101              Component comp = component[i];              Component comp = component[i];
1102              boolean applicable = comp.isVisible()              boolean applicable = comp.isVisible()
1103                && (comp.isLightweight() || !lightweightOnly);                && (comp.isLightweight() || !lightweightOnly);
1104    
1105              if (applicable)              if (applicable)
1106                visitChild(gfx, visitor, comp);                visitChild(gfx, visitor, comp);
1107            }            }
1108        }        }
1109    }    }
# Line 1100  public class Container extends Component Line 1152  public class Container extends Component
1152    {    {
1153      synchronized (getTreeLock ())      synchronized (getTreeLock ())
1154        {        {
1155          int start, end;          int start, end;
1156          if (child != null)          if (child != null)
1157            {            {
1158              for (start = 0; start < ncomponents; ++start)              for (start = 0; start < ncomponents; ++start)
1159                {                {
1160                  if (component[start] == child)                  if (component[start] == child)
1161                    break;                    break;
1162                }                }
1163              end = start;              end = start;
1164              // This special case lets us be sure to terminate.              // This special case lets us be sure to terminate.
1165              if (end == 0)              if (end == 0)
1166                end = ncomponents;                end = ncomponents;
1167              ++start;              ++start;
1168            }            }
1169          else          else
1170            {            {
1171              start = 0;              start = 0;
1172              end = ncomponents;              end = ncomponents;
1173            }            }
1174    
1175          for (int j = start; j != end; ++j)          for (int j = start; j != end; ++j)
1176            {            {
1177              if (j >= ncomponents)              if (j >= ncomponents)
1178                {                {
1179                  // The JCL says that we should wrap here.  However, that                  // The JCL says that we should wrap here.  However, that
1180                  // seems wrong.  To me it seems that focus order should be                  // seems wrong.  To me it seems that focus order should be
1181                  // global within in given window.  So instead if we reach                  // global within in given window.  So instead if we reach
1182                  // the end we try to look in our parent, if we have one.                  // the end we try to look in our parent, if we have one.
1183                  if (parent != null)                  if (parent != null)
1184                    return parent.findNextFocusComponent(this);                    return parent.findNextFocusComponent(this);
1185                  j -= ncomponents;                  j -= ncomponents;
1186                }                }
1187              if (component[j] instanceof Container)              if (component[j] instanceof Container)
1188                {                {
1189                  Component c = component[j];                  Component c = component[j];
1190                  c = c.findNextFocusComponent(null);                  c = c.findNextFocusComponent(null);
1191                  if (c != null)                  if (c != null)
1192                    return c;                    return c;
1193                }                }
1194              else if (component[j].isFocusTraversable())              else if (component[j].isFocusTraversable())
1195                return component[j];                return component[j];
1196            }            }
1197    
1198          return null;          return null;
1199        }        }
1200    }    }
1201    
# Line 1151  public class Container extends Component Line 1203  public class Container extends Component
1203    {    {
1204      synchronized (getTreeLock ())      synchronized (getTreeLock ())
1205        {        {
1206          for (int i = ncomponents;  --i >= 0; )          for (int i = ncomponents;  --i >= 0; )
1207            {            {
1208              component[i].addNotify();              component[i].addNotify();
1209              if (component[i].isLightweight())              if (component[i].isLightweight())
1210                enableEvents(component[i].eventMask);                enableEvents(component[i].eventMask);
1211            }            }
1212        }        }
1213    }    }
1214    
   
1215    // Nested classes.    // Nested classes.
1216    
1217    /* The following classes are used in concert with the    /* The following classes are used in concert with the
# Line 1200  public class Container extends Component Line 1251  public class Container extends Component
1251     * This class provides accessibility support for subclasses of container.     * This class provides accessibility support for subclasses of container.
1252     *     *
1253     * @author Eric Blake <ebb9@email.byu.edu>     * @author Eric Blake <ebb9@email.byu.edu>
1254       *
1255     * @since 1.3     * @since 1.3
1256     */     */
1257    protected class AccessibleAWTContainer extends AccessibleAWTComponent    protected class AccessibleAWTContainer extends AccessibleAWTComponent
# Line 1234  public class Container extends Component Line 1286  public class Container extends Component
1286      public int getAccessibleChildrenCount()      public int getAccessibleChildrenCount()
1287      {      {
1288        synchronized (getTreeLock ())        synchronized (getTreeLock ())
1289          {          {
1290            int count = 0;            int count = 0;
1291            int i = component == null ? 0 : component.length;            int i = component == null ? 0 : component.length;
1292            while (--i >= 0)            while (--i >= 0)
1293              if (component[i] instanceof Accessible)              if (component[i] instanceof Accessible)
1294                count++;                count++;
1295            return count;            return count;
1296          }          }
1297      }      }
1298    
1299      /**      /**
# Line 1253  public class Container extends Component Line 1305  public class Container extends Component
1305      public Accessible getAccessibleChild(int i)      public Accessible getAccessibleChild(int i)
1306      {      {
1307        synchronized (getTreeLock ())        synchronized (getTreeLock ())
1308          {          {
1309            if (component == null)            if (component == null)
1310              return null;              return null;
1311            int index = -1;            int index = -1;
1312            while (i >= 0 && ++index < component.length)            while (i >= 0 && ++index < component.length)
1313              if (component[index] instanceof Accessible)              if (component[index] instanceof Accessible)
1314                i--;                i--;
1315            if (i < 0)            if (i < 0)
1316              return (Accessible) component[index];              return (Accessible) component[index];
1317            return null;            return null;
1318          }          }
1319      }      }
1320    
1321      /**      /**
# Line 1271  public class Container extends Component Line 1323  public class Container extends Component
1323       * coordinates), if one exists.       * coordinates), if one exists.
1324       *       *
1325       * @param p the point to look at       * @param p the point to look at
1326         *
1327       * @return an accessible object at that point, or null       * @return an accessible object at that point, or null
1328         *
1329       * @throws NullPointerException if p is null       * @throws NullPointerException if p is null
1330       */       */
1331      public Accessible getAccessibleAt(Point p)      public Accessible getAccessibleAt(Point p)
# Line 1286  public class Container extends Component Line 1340  public class Container extends Component
1340       * when children are added or removed from the enclosing accessible object.       * when children are added or removed from the enclosing accessible object.
1341       *       *
1342       * @author Eric Blake <ebb9@email.byu.edu>       * @author Eric Blake <ebb9@email.byu.edu>
1343         *
1344       * @since 1.3       * @since 1.3
1345       */       */
1346      protected class AccessibleContainerHandler implements ContainerListener      protected class AccessibleContainerHandler implements ContainerListener
# Line 1324  public class Container extends Component Line 1379  public class Container extends Component
1379    } // class AccessibleAWTPanel    } // class AccessibleAWTPanel
1380  } // class Container  } // class Container
1381    
   
1382  /**  /**
1383   * Undocumented helper class.   * Undocumented helper class.
1384   * STUBBED   * STUBBED
# Line 1339  class LightweightDispatcher implements S Line 1393  class LightweightDispatcher implements S
1393    private transient boolean isMouseInNativeContainer;    private transient boolean isMouseInNativeContainer;
1394    private Cursor nativeCursor;    private Cursor nativeCursor;
1395    private long eventMask;    private long eventMask;
1396      
1397    LightweightDispatcher(Container c)    LightweightDispatcher(Container c)
1398    {    {
1399    }    }
1400    
1401    void dispose()    void dispose()
1402    {    {
1403    }    }
1404    
1405    void enableEvents(long l)    void enableEvents(long l)
1406    {    {
1407    }    }
1408    
1409    boolean dispatchEvent(AWTEvent e)    boolean dispatchEvent(AWTEvent e)
1410    {    {
1411      return true;      return true;
1412    }    }
1413    
1414    boolean isMouseGrab(MouseEvent e)    boolean isMouseGrab(MouseEvent e)
1415    {    {
1416      return true;      return true;
1417    }    }
1418    
1419    boolean processMouseEvent(MouseEvent e)    boolean processMouseEvent(MouseEvent e)
1420    {    {
1421      return true;      return true;
1422    }    }
1423    
1424    void trackMouseEnterExit(Component c, MouseEvent e)    void trackMouseEnterExit(Component c, MouseEvent e)
1425    {    {
1426    }    }
1427    
1428    void startListeningForOtherDrags()    void startListeningForOtherDrags()
1429    {    {
1430    }    }
1431    
1432    void stopListeningForOtherDrags()    void stopListeningForOtherDrags()
1433    {    {
1434    }    }
1435    
1436    public void eventDispatched(AWTEvent e)    public void eventDispatched(AWTEvent e)
1437    {    {
1438    }    }
1439    
1440    void retargetMouseEvent(Component c, int i, MouseEvent e)    void retargetMouseEvent(Component c, int i, MouseEvent e)
1441    {    {
1442    }    }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26