I've tried this and it worked. I didn't paste the whole code because I'm typing on my mac and surfing the internet through PC. I'd just like to ask if it's ok to do this practice? Or is ther something I should avoid in doing this? Thanks!
Hmmm... I'd like to see what happens when you try to add components to the second JFrame.
Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
Joined: Jul 14, 2005
So, I tried it.
Compiles just fine, but running it....
Exception in thread "main" java.lang.Error: Do not use javax.swing.JFrame.add() use javax.swing.JFrame.getContentPane().add() instead at javax.swing.JFrame.createRootPaneException(JFrame.java:465) at javax.swing.JFrame.addImpl(JFrame.java:491) at java.awt.Container.add(Container.java:307) at Testing.<init>(Testing.java:16) at Testing.main(Testing.java:27)
So I'm thinking you can't use your container for both windows without some fancy foot work.
And this example won't compile.
Compile error: container is already defined in Testing()
BUT! You can do this.
Thanks! That was fun! [ October 12, 2005: Message edited by: Stephen Boston ]