Abhishek Patel
Abhishek Patel

Reputation: 53

Display JFrame inside JPanel in java

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

Answers (2)

Hovercraft Full Of Eels
Hovercraft Full Of Eels

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

thermz
thermz

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

Related Questions