Eventos não estão mais funcionando - java se

Olá, estou com um probleminha que é a primeira vez que vejo isso, nenhum evento esta funcionando, ActionPerformed não esta funcionando em nenhuum menu, botão que coloque :confused: desde já agradeço.

package view;

import DAO.ConnectDB;
import com.sun.java.accessibility.util.AWTEventMonitor;
import java.awt.;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.
;

public class Main extends javax.swing.JFrame {

ConnectDB connect = new ConnectDB(); // Variavel Global

int id_usuario, id_empresa, id_agencia, id_cidade, id_estado;

public Main() 
{
    initComponents();
    
    //Config Main System
    getContentPane().setBackground(Color.WHITE);
    setFont(new Font("Sogeo UI", Font.BOLD, 12));
    
    starte();
    
}

public void recebe_nomeCompleto(String nomeCompleto, int idUsuario) {
    jLabel_user.setText(nomeCompleto);
    id_usuario = idUsuario;
    sad();
    //Main.setAgencia(fullname);
}

public void starte() 
{
    // Seta o nome da Maquina
    try
    {
        jLabel_maquina.setText(InetAddress.getLocalHost().getHostAddress());
    }
    catch(Exception erro)
    {
        jLabel_maquina.setText("Não foi possivel identificar a Maquina em uso.");
        jLabel_maquina.setForeground(new Color(204,0,0));
    }
    // Fim pega nome da maquina
}

private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
this.disable();
System.err.println(“asdasdasdasdasdasdasd”);
}

private void jMenu_encomendasActionPerformed(java.awt.event.ActionEvent evt) {                                                 
   
    
    JOptionPane.showMessageDialog(null, "TESTANDO ENCOMENDAS");
}                                                

private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
    Timer timer = new Timer(1000, new ChecksConnect());
    timer.start(); 
}                                 

class ChecksConnect implements ActionListener 
{
    @Override
    public void actionPerformed(ActionEvent e)
    {
        // Valida Status de Conexão
        if(connect.Connection() == true)
        {
            jLabel_Conn_Status.setText("Conectado");
            jLabel_Conn_Status.setForeground(new Color(0,153,0));
        }
        if(connect.Connection() == false)
        {
            jLabel_Conn_Status.setText("Desconectado");
            jLabel_Conn_Status.setForeground(new Color(204,0,0));
        }
        
    }
}

}

Quando postar código fonte, selecione ele e clique no botão de Texto pré-formatado, identificado pelo símbolo </>

O código que você postou está cheio de erros de compilação e não há nenhum botão ou menu nele.

pronto, desculpe rsrs. 
a classe toda aii, o evento no menuBar não executa somente executa os bottons. :confused: 

package view;

import DAO.ConnectDB;
import com.sun.java.accessibility.util.AWTEventMonitor;
import encomendas.telaEncomendas;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;

public class Main extends javax.swing.JFrame {
    
    ConnectDB connect = new ConnectDB(); // Variavel Global
    
    int id_usuario, id_empresa, id_agencia, id_cidade, id_estado;
    
    
    telaEncomendas telaEnco = new telaEncomendas();
    
    public Main() 
    {
        initComponents();
        
        //Config Main System
        getContentPane().setBackground(Color.WHITE);
        setFont(new Font("Sogeo UI", Font.BOLD, 12));
        
        starte();
        
    }
    
    public void recebe_nomeCompleto(String nomeCompleto, int idUsuario) {
        jLabel_user.setText(nomeCompleto);
        id_usuario = idUsuario;
        sad();
        //Main.setAgencia(fullname);
    }
    
    public void starte() 
    {
        // Seta o nome da Maquina
        try
        {
            jLabel_maquina.setText(InetAddress.getLocalHost().getHostAddress());
        }
        catch(Exception erro)
        {
            jLabel_maquina.setText("Não foi possivel identificar a Maquina em uso.");
            jLabel_maquina.setForeground(new Color(204,0,0));
        }
        // Fim pega nome da maquina
    }
    
    public void sad() 
    {
        try  
        {    
            connect.Connection();
            connect.executaSQL("SELECT * FROM usuarios WHERE id_usuario ='"+id_usuario+"'");
            while (connect.rs.next()) 
            {
                id_empresa = connect.rs.getInt("id_empresa");
                id_agencia = connect.rs.getInt("id_agencia");
            }
            
            connect.executaSQL("SELECT * FROM empresas WHERE id_empresa ='"+id_empresa+"'");
            while (connect.rs.next()) 
            {
                jLabel_empresa.setText(connect.rs.getString("nome"));
            }
            
            connect.executaSQL("SELECT * FROM agencias WHERE id_agencia ='"+id_agencia+"'");
            while (connect.rs.next()) 
            {
                jLabel_agencia.setText(connect.rs.getString("sigla"));
                id_cidade = connect.rs.getInt("id_cidade");
            }
            
            connect.executaSQL("SELECT * FROM cidades WHERE id_cidade ='"+id_cidade+"'");
            while (connect.rs.next()) 
            {
                jLabel_localidade.setText(connect.rs.getString("nome"));
                id_estado = connect.rs.getInt("id_estado");
            }
            
            connect.executaSQL("SELECT * FROM estados WHERE id_estado ='"+id_estado+"'");
            while (connect.rs.next()) 
            {
                String nomeCidade = jLabel_localidade.getText();
                jLabel_localidade.setText(nomeCidade + " - " +connect.rs.getString("uf"));
            }
        }
        catch(SQLException e)
        {
            System.err.println("ERRO         " + e);
        }
        
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        ImageIcon icon = new ImageIcon(getClass().getResource("/img/bg.jpg"));
        Image image = icon.getImage();
        jDesktopPane_home = new javax.swing.JDesktopPane(){

            public void paintComponent(Graphics g)
            {
                g.drawImage(image,0,0, getWidth(), getHeight(), this);
            }

        };
        jPanel1 = new javax.swing.JPanel();
        jLabel_Conn_Status = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel_user = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel_empresa = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel_agencia = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel_localidade = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel_maquina = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jMenuBar_home = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SISTEMA GERENCIADOR DE VENDAS DE PASSAGEM - SGVP");
        setBackground(new java.awt.Color(255, 255, 255));
        setName("jFrame_Main"); // NOI18N
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel_Conn_Status.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel1.setText("Nome de Usuario:");

        jLabel_user.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel_user.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel4.setText("Empresa:");

        jLabel_empresa.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel_empresa.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel6.setText("Agência:");

        jLabel_agencia.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel_agencia.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel2.setText("Localidade:");

        jLabel_localidade.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel_localidade.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel3.setText("Maquina:");

        jLabel_maquina.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel_maquina.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel_user)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel_empresa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel_agencia)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel_localidade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel_maquina)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 894, Short.MAX_VALUE)
                .addComponent(jLabel_Conn_Status)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel_user, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel_Conn_Status, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLabel_empresa, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel_localidade, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel_maquina, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, Short.MAX_VALUE))
            .addComponent(jLabel_agencia, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jDesktopPane_home.setLayer(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane_home.setLayer(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout jDesktopPane_homeLayout = new javax.swing.GroupLayout(jDesktopPane_home);
        jDesktopPane_home.setLayout(jDesktopPane_homeLayout);
        jDesktopPane_homeLayout.setHorizontalGroup(
            jDesktopPane_homeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jDesktopPane_homeLayout.createSequentialGroup()
                .addGap(550, 550, 550)
                .addComponent(jButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jDesktopPane_homeLayout.setVerticalGroup(
            jDesktopPane_homeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDesktopPane_homeLayout.createSequentialGroup()
                .addGap(97, 97, 97)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jMenu1.setText("File");
        jMenuBar_home.add(jMenu1);

        jMenu2.setText("Edit");
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });
        jMenuBar_home.add(jMenu2);

        setJMenuBar(jMenuBar_home);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane_home)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane_home, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>                        

    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
        Timer timer = new Timer(1000, new ChecksConnect());
        timer.start(); 
    }                                 

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        
        
        if(telaEnco.isVisible())
        {
            JOptionPane.showMessageDialog(null, "Janela Já Aberta");
        }
        else
        {
            telaEnco.setVisible(true);
            jDesktopPane_home.add(telaEnco);
            telaEnco.setPosicao();
            telaEnco.moveToFront(); 
        }
       
    }                                        

    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {                                       
        System.out.println("DEU CERTO");
    }                                      


    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    private javax.swing.JDesktopPane jDesktopPane_home;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private static javax.swing.JLabel jLabel_Conn_Status;
    private javax.swing.JLabel jLabel_agencia;
    private javax.swing.JLabel jLabel_empresa;
    private javax.swing.JLabel jLabel_localidade;
    private javax.swing.JLabel jLabel_maquina;
    private javax.swing.JLabel jLabel_user;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar_home;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration                   

    class ChecksConnect implements ActionListener 
    {
        @Override
        public void actionPerformed(ActionEvent e)
        {
            // Valida Status de Conexão
            if(connect.Connection() == true)
            {
                jLabel_Conn_Status.setText("Conectado");
                jLabel_Conn_Status.setForeground(new Color(0,153,0));
            }
            if(connect.Connection() == false)
            {
                jLabel_Conn_Status.setText("Desconectado");
                jLabel_Conn_Status.setForeground(new Color(204,0,0));
            }
            
        }
    }
}

Seu problema está aqui:

    jMenu2.setText("Edit");
    jMenu2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenu2ActionPerformed(evt);
        }
    });

Você está adicionando um ActionListener à um JMenu, mas ActionListener só é disparado por JMenuItem.
Se quer tratar eventos disparados por um JMenu, você precisa adicionar um MenuListener.

1 curtida

Muito Obrigado, Salvo <3