why addcomponent and removecomponent method are not in component class,

Hi,why addcomponent and removecomponent method are not in component oand component class,Thank you
[119 byte] By [uvariSubasha] at [2007-11-27 5:55:06]
# 1
Because a Component is not necessarily a Container.Message was edited by: bsampieri
bsampieria at 2007-7-12 15:50:21 > top of Java-index,Java Essentials,Java Programming...
# 2

java.awt.Container has the appropriate add and remove methods:

http://java.sun.com/javase/6/docs/api/java/awt/Container.html

If that seems odd to you, you need to think about the Composite Pattern:

http://en.wikipedia.org/wiki/Composite_pattern

[url #" style="display: block; background-image: url('http://upload.wikimedia.org/wikipedia/en/1/13/Compositepattern.png'); width: 406px; height: 271px] [/url]

Hippolytea at 2007-7-12 15:50:21 > top of Java-index,Java Essentials,Java Programming...