简体   繁体   English

使用NetBeans UI设计器,如何从一个项目复制UI组件并将其粘贴到另一个项目中?

[英]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.

相关问题 如何在IntelliJ中将项目库从一个项目复制到另一个项目? - How can I copy project libraries from one project into another one in IntelliJ? 是否可以使用Netbeans GUI设计器从数据库表构建UI元素? - Is it possible to build UI elements from a database table using the Netbeans GUI designer? Android Studio:如何将.sfb文件从一个项目复制/粘贴到另一个项目? - Android Studio : how to copy/paste a .sfb file from one project to another? 如何将appengine数据库从一个应用程序复制到另一个应用程序 - java项目 - How can I copy appengine database from one application to another - java project NetBeans FileChooser。 如何使用它将文件从一个位置复制到字符串中定义的另一个位置? - NetBeans FileChooser. How do I use it to copy a file from one location to another defined in a string? 如何使用Codename One访问.res文件中的UI组件? - How do I access UI components in a .res file with Codename One? 从记事本++复制粘贴到NetBeans - Copy and Paste from Notepad ++ to NetBeans 如何在运行时将组件添加到使用Netbeans可视编辑器创建的Swing UI中? - How do I add components at run time to a Swing UI created with Netbeans visual editor? Java从另一个线程更新UI组件 - java updating UI components from another thread Vaadin UI从其他线程更改UI组件时未更新 - Vaadin UI not updating while changing UI components from another thread
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM