2

如何将 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

来自Netbeans 常见问题解答

此方法不起作用,因为这些类不可供选择。

但是,我能够将 NewJPane 拖到 NewJFrame 的设计视图中,在该视图中使用正确类型的 NewJPane(而不是 JPane)声明了它。

在此处输入图像描述

4

1 回答 1

1

您可以将自定义组件添加到 matisse GUI 调色板。

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 所知,您可以将它拖到新面板中。

于 2012-06-28T23:44:20.763 回答