简体   繁体   English

与JDialog共享JPanel

[英]Sharing a JPanel with a JDialog

I'm trying to reuse a JPanel inside a JDialog instead of replicating another JPanel that has the exact features. 我正在尝试在JDialog中重用JPanel,而不是复制具有确切功能的另一个JPanel。 I tried removing and adding the component to the JDialog, but it's not working as I expected. 我尝试删除该组件并将其添加到JDialog,但是它没有按预期工作。 What is the recommended approach to this issue? 建议使用什么方法来解决此问题?

write a class "myFeaturesJPanel" that extends jPanel having the needed features. 编写一个类“ myFeaturesJPanel”,以扩展具有所需功能的jPanel。 then just add a own instance to your popUpPanel and your original panel 然后只需将自己的实例添加到您的popUpPanel和原始面板中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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