Reputation: 53
Is this possible to add a JFrame into a JPanel in Java. i m using a java program which is giving output as a frame which i wanted to display inside another program's JPanel on click of a button. How can i do this?
Upvotes: 5
Views: 17035
Reputation: 285430
You could call getContentPane()
on the JFrame to extract its main contents as a JPanel (usually) and without the menu bar and decorations, and display that as a JPanel though best would probably be to update the original program so that it produces a JPanel and not a JFrame.
Upvotes: 2
Reputation: 2406
Read about JInternalFrame
. I think it's the way to go here.
http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html
Upvotes: 3