How to Delete Methods Automatically Generated by Netbeans?

Asked

Viewed 3,023 times

4

I’m making a GUI using the JFrame automatically generated by the Netbeans IDE and had twice-clicked on a JButton unintentionally and it automatically generated a code of ActionEvent which cannot be edited.

As I did not want these methods that I would not use, I opened the code by another editor (Sublime) and removed them completely, both his methods and his calls on private void initComponents().

After deleting them by sublime they ceased to exist when opened in Netbeans and the code ran normally.

The problem is that every time I change something in Netbeans, those methods mysteriously get called back in private void initComponents(). With this, in order to compile without mistakes, I have to keep opening the Sublime again and remove them.

Ex: Code that I delete but mysteriously returns

Código que surge misteriosamente depois que excluo

Could someone help me?

1 answer

4


Do the following:

  1. Select the JButton(simple click);
  2. goes in the Propriedades(bottom right sidebar), and click eventos;
  3. Click the button ... next to the event being created(see in the photo an example of how it should be):

inserir a descrição da imagem aqui

  1. In the window that opens, select the button action method and click Remove and then in okay:

inserir a descrição da imagem aqui

  1. See in the code, the method was removed there too.

inserir a descrição da imagem aqui

  • 2

    It worked! Thanks =]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.