Thanks Val for reminder:
I ran and edited my code, below I add a Window and a Frame to a subclass object of Frame. The strange thing is the second add gives the same
error message: why a Frame is considered a Window here? Sure, Frame is a subclass of Window. Any insights?
import java.awt.*;
public class container1 extends Frame
{
public container1() {super();}
public static void main(String[] args)
{
container1 cn=new container1();
Frame f=new Frame();
Window wd=new Window(f);
//IllegalArgumentException:
//adding window to a container
cn.add(wd);
//IllegalArgumentException:
//adding window to a container
cn.add(f);
}
}
victor
Originally posted by Rob Ross:
Valentin,
I'm pretty sure you just made a simple typo above, because the answers are c & e, NOT c & d as you wrote.
It's perfectly legal to add a textarea to a container, but it's an error to try to add the container's parent to the container.
[ February 07, 2002: Message edited by: victor gu ]
[ February 07, 2002: Message edited by: victor gu ]