I can’t program a jFrame button

Asked

Viewed 118 times

0

Every time I double-click the button to open Actionperformed from it, Netbeans creates it in the middle of another button’s Actionperformade. Original code: inserir a descrição da imagem aqui

 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // TODO add your handling code here:
    if(jTable.getSelectedRow()>-1){
    jComboBox1.removeAllItems();
    suamae.forEach((nana) -> {
        jComboBox1.addItem(nana);
    });

    
   String[] isso = new String[4];
   for(int sim =0; sim<4;sim++){
   isso[sim]=jTable.getValueAt(jTable.getSelectedRow(),sim).toString();
   
   }
   jTextField1.setText(isso[0]);
   jComboBox2.setSelectedItem(isso[1]);
   jComboBox1.setSelectedItem(isso[2]);
   
   jPanel1.setVisible(true);
          
}                                        
else{
        JOptionPane.showMessageDialog(this, "Você não cadastrou animais");
    }}

After double-clicking on the new button to change your code:

inserir a descrição da imagem aqui

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // TODO add your handling code here:
    if(jTable.getSelectedRow()>-1){
    jComboBox1.removeAllItems();
    suamae.forEach((nana) -> {
        jComboBox1.addItem(nana);
    });

    
   String[] isso = new String[4];
   for(int sim =0; sim<4;sim++){
   isso[sim]=jTable.getValueAt(jTable.getSelectedRow(),sim).toString();
   
   }
   jTextField1.setText(isso[0]);
   jComboBox2.setSelectedItem(isso[1]);
   jComboBox1.setSelectedItem(isso[2]);
   
   jPanel1.setVisible(true);
          
}                                        

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // TODO add your handling code here:
}                                        
else{
        JOptionPane.showMessageDialog(this, "Você não cadastrou animais");
    }}

I tried to change the button name, restart the netbeans, take Else out and put it back in place, but nothing was right. All the error code after doing this.

Someone knows what I can do?

Do not call the name of the kkkkk variables

  • Do not add code in image form, edit the question and add textual, in the form of a [mcve] so that it is possible to execute.

  • Edited! I put the code snippet that error

  • Face this seems to be defective, reinstall the ide and ve resolve

No answers

Browser other questions tagged

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