Getting grid layout to work with a class that extends JFrame

In my code, I have a class extending JFrame and setting the layout to grid works and the code to add with three parameters compiles just fine but when I run it I get this:

java.lang.IllegalArgumentException: illegal component position

at java.awt.Container.addImpl(Container.java:999)

at java.awt.Container.add(Container.java:928)

at javax.swing.JFrame.addImpl(JFrame.java:479)

at java.awt.Container.add(Container.java:928)

on the add(myLabel, 1, 1);

line

[505 byte] By [petrockthiefa] at [2007-10-2 10:48:27]
# 1

I see on these from

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html#add(java.awt.Component)

1.public Component add(Component comp)

2.public Component add(String name, Component comp)

3.public Component add(Component comp, int index)

you should use method add(...) of JPanel instead

under_warea at 2007-7-13 3:04:52 > top of Java-index,Desktop,Core GUI APIs...