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.