简体   繁体   中英

Is it possible to add a JFrame to a JPanel in java?

I have been working on a series of JPanel and I wanted to add a JFrame from another class to one of my panels. Can this be done.

No, you cannot add any Window to another component, doing so results in a RuntimeException . What you can do is add the contentPane from the JFrame to your JPanel .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM