开发者

Call jpanel form from jFrame form with parameter in java

I am working in jpanel form (drag and drop ) in netbeans. From jframe form开发者_StackOverflow社区 i want to call a jpanel form and want to pass parent frame as parameter . How can I do that in drag and drop in netbeans ?


You can access the parent component of a Swing component using getParent().

See Component.getParent() for details.


In the gui editor, you can edit the custom creation code to call a constructor of your choice. Your panel must still have a no argument blank constructor as it is a bean.

right click your panel->properties->code->custom creation code.

new MyPanel(this)

Or get the parent as mentioned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜