简体   繁体   English

在设计选项卡中双击对象后删除 Netbeans 自动生成的代码

[英]Remove Netbeans Auto Generated Code After Double-Clicking an Object in Design Tab

So Im using Netbeans and the Design tab, placing labels, textboxes, etc. Great, however when you double-click on say a label it autogenerated this code:所以我使用 Netbeans 和“设计”选项卡,放置标签、文本框等。很好,但是当你双击说出一个标签时,它会自动生成这段代码:

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

Now I didn't want it to do that, but when I highlight and attempt to delete it - Netbeans does not allow me to do so.现在我不希望它这样做,但是当我突出显示并尝试删除它时 - Netbeans 不允许我这样做。 How do I go about removing this?我该如何删除它?

In the Design mode you select the particular object and click Events under Properties and remove the event from the event property在设计模式中,您选择特定对象并单击属性下的事件,然后从事件属性中删除该事件

To answer Brian's question on the more general case:回答布赖恩关于更一般情况的问题:

If you have auto-generated variables that are hiding in the Design mode, and you cannot select and remove them, you can usually delete them with the following steps(in NetBeans7.4):如果您有自动生成的变量隐藏在设计模式下,并且您无法选择和删除它们,您通常可以通过以下步骤删除它们(在 NetBeans7.4 中):

  1. Go in the Design mode to the top window menu -> Windows -> Navigator .在设计模式下转到顶部窗口menu -> Windows -> Navigator You will see Group "Navigator" popped up on the left (usually).您会看到左侧弹出“导航器”组(通常)。
  2. Now you can delete unwanted variables (or edit them) with the right click menu.现在您可以使用右键单击菜单删除不需要的变量(或编辑它们)。

Easiest Solution最简单的解决方案

Close net beans IDE and open the source file you need to change in a text editor available in your system.关闭 net beans IDE 并在系统可用的文本编辑器中打开需要更改的源文件。 then you can remove (also can edit) your line of code.Then save the changes.然后你可以删除(也可以编辑)你的代码行。然后保存更改。 After that open netbeans you can see the changes in netbeans.之后打开netbeans就可以看到netbeans的变化了。

hope helpfull for you!!希望对你有帮助!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM