[英]Using NetBeans UI designer, how can I copy UI components from one project and paste them into another?
I'm using NetBeans 7.4. 我正在使用NetBeans 7.4。 I've created a new UI using the designer.
我使用设计器创建了一个新的UI。 I would like to use a old UI design from another project in this new project, "cutting and pasting" all the components from the old design's JFrame and inserting them into the new design's JPanel.
我想在这个新项目中使用另一个项目中的旧UI设计,“剪切和粘贴”旧设计的JFrame中的所有组件,并将它们插入新设计的JPanel中。
Does NetBeans provide any method to do this in the design tool rather than the source? NetBeans是否在设计工具中提供了任何方法来执行此操作,而不是提供源代码? I'm hesitant to edit the generated code, having corrupted designs in the past.
我不愿意编辑生成的代码,因为过去曾破坏过设计。
If the form is in a separate class, a possible solution is to import the component from the old project with the Palette Manager. 如果表单在单独的类中,则可能的解决方案是使用调色板管理器从旧项目中导入组件。
Menu: Tools => Palette => Swing/AWT Components => Add from Project 菜单:工具=>调色板=> Swing / AWT组件=>从项目添加
The component will be available in the Palette. 该组件将在组件面板中可用。
Open the design tab of the frame you want to copy, then hold Shift and drag the mouse over all the design elements. 打开要复制的框架的设计选项卡,然后按住Shift并将鼠标拖动到所有设计元素上。
You can then copy them all and paste in another JFrame. 然后,您可以将它们全部复制并粘贴到另一个JFrame中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.