如何使用NetBeans GUI Builder包含自定义面板? [英] How to include custom panel with NetBeans GUI Builder?

查看:202
本文介绍了如何使用NetBeans GUI Builder包含自定义面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个扩展JPanel的类。是否可以在NetBeans GUI Builder中使用它并使其在所有自动代码生成中继续使用?

I have written a class that extends JPanel. Is it possible to use this in the NetBeans GUI Builder and have it survive all of the automatic code generation?

我在GUI构建器中使用了自定义代码选项来实例化将对象作为新类,但似乎无法从JPanel更改声明,因此只有我重写的方法才会被调用,我不能调用JPanel中不存在的新方法。

I have used the customised code option in the GUI builder to instantiate the object as the new class, but it seems like the declaration can't be changed from JPanel, so only methods that I have overridden get called, I can't call new ones that are not present in JPanel.

推荐答案

只需将类从项目树拖到GUI设计器中的表单即可。

Simply drag the class from the projects tree on to the form in the GUI designer.

就像它在 stackoverflow问题691890中所述

这篇关于如何使用NetBeans GUI Builder包含自定义面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆