views:

29

answers:

2

hi i am using netBeans editor to create desktop application , i did something wrong that generate three line of code in the initComponent() method related to connection with database. Then i removed the lines by opening the .java file in txt editor , but one of them keep coming back when i do anything with netBeans editor , So i want to delete this line from the netbeans itself . this is the line

historyList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : ((javax.persistence.Query)null).getResultList();

and this is its declaration

private java.util.List<idetect.History> historyList;
+1  A: 

I think the simplest way to edit the automatically generated code is to do the following;

If you go to the Design panel of your class in Netbeans (where you can see the constructed GUI) then all of the elements you have added will be in the Navigator Pane, which is usually located in the bottom left. If you can't see the Navigator pane then ctrl+7 brings it up. Find the element you wish to remove in the list, right click and click Refactor > Safely Delete.

Personally if I need to write a GUI in Netbeans I use it to generate the boring stuff, and then paste the generated code into a different editor to write my actions.

Jivings
A: 

The java source is regenerated automatically from the matching .form file. You need to delete the component either from the GUI editor itself or from the form file(which is not visible in NetBeans).

When you've opened a GUI form in NetBeans its components are visible in a tree in the Inspector tab in the lower left part of your screen. You can select the component you want to delete there, right click and select "Delete".

Bozhidar Batsov