How to add JFrame within JFrame

Hi, I want to add jFrame within JFrame just like JInternalFrame, But I don't want to use JInternalFrame.
[119 byte] By [RajeevSaxenaa] at [2007-11-27 9:29:49]
# 1
OK I'll bite... why don't you want to use jInternalFrame?
c0demonk3ya at 2007-7-12 22:39:23 > top of Java-index,Desktop,Core GUI APIs...
# 2
may be1) he do not know how to use it2) he do not like the implementation3) he do not like the way it worksso he said simply do not want to use...
Aniruddha-Herea at 2007-7-12 22:39:23 > top of Java-index,Desktop,Core GUI APIs...
# 3
You don't. A JFrame is a top-level container, it can't be contained within a JFrame.... Of course, JFrame A could be maximized with JFrame B on top of it, that would give the effect of being within.
bsampieria at 2007-7-12 22:39:23 > top of Java-index,Desktop,Core GUI APIs...
# 4

Im not really sure why you would want to do this, but what you could do is add the JFrame's contentPane to a JPanel, and then put it in the other one.

So lets say you have two JFrame objects: frame1 and frame2

JPanel frame2Content = new JPanel();

frame2Content.add(frame2.getContentPane());

frame1.getContentPane().add(frame2Content);

Depending on your layout manager, that would allow you to put frame2's components, as a panel, somewhere in frame1.

BeginBHa at 2007-7-12 22:39:23 > top of Java-index,Desktop,Core GUI APIs...