OSDN Git Service

* All files: Updated copyright to reflect Cygnus purchase.
[pf3gnuchains/gcc-fork.git] / libjava / java / awt / Container.java
1 /* Copyright (C) 1999  Red Hat, Inc.
2
3    This file is part of libjava.
4
5 This software is copyrighted work licensed under the terms of the
6 Libjava License.  Please consult the file "LIBJAVA_LICENSE" for
7 details.  */
8
9 package java.awt;
10
11 /* A very incomplete placeholder. */
12
13 public abstract class Container extends Component
14 {
15   int componentCount;
16   Component[] components;
17
18   public Component[] getComponents()
19   {
20     Component[] result = new Component[componentCount];
21     if (componentCount > 0)
22       System.arraycopy(components, 0, result, 0, componentCount);
23     return result;
24   }
25
26   public Component getComponent (int n)
27   {
28     if (n < 0 || n >= componentCount)
29       throw new ArrayIndexOutOfBoundsException("no such component");
30     return components[n];
31   }
32
33   public boolean isAncestorOf (Component comp)
34   {
35     for (;;)
36       {
37         if (comp == null)
38           return false;
39         if (comp == this)
40           return true;
41         comp = comp.getParent();
42       }
43   }
44
45   public Component add (String name, Component comp)
46   {
47     /* FIXME */
48     return comp;
49   }
50
51   public void addNotify ()
52   {
53     for (int i = componentCount;  --i >= 0; )
54       components[i].addNotify();
55   }
56
57   public void setLayout (LayoutManager layout)
58   { /* FIXME */ }
59 }