如何将NewJPanel(一个扩展JPanel的Netbeans生成的类)添加到GUI构建器的调色板中?
目标是能够通过调色板添加NewJPanel,使其具有类型NewJPanel而不是类型JPanel。但是,正如我所料,它不能通过调色板获得。
我正在关注:
通过调色板管理器安装
Open the Palette Manager from main menu: Tools | Palette Manager | Swing/AWT Components In the Palette Manager press button according to where the component comes from. The choices are: from an external JAR file from a library defined in the IDE (always create a library if the components need more than one JAR) from a NetBeans project
此方法不起作用,因为这些类不可用于选择。
但是,我能够将NewJPane拖到NewJFrame的设计视图中,其中使用正确类型的NewJPane(而不是JPane)声明它。
答案 0 :(得分:1)
您可以将自定义组件添加到matisse GUI palatte。
Build your project so the class file you want to use is part of the jar file
Open a java class that has a form, and switch to design mode. 3, Right click in the palatte and choose "palatte manager".
Choose the "add from jar" button to select your jar.
Choose the class you made, and add it to your palatte.
现在您的面板已知为netbeans,您可以将其拖动到新面板中。