Problema Comando não executa - Netbeans

Galera seguinte tenho esse lblSQL preciso retornar algo nele e para testar estou ja colocando valores nele mas nada executa, note que está dentro de um timer oque eu faço ?

private void timer1OnTime(java.awt.event.ActionEvent evt) {                              

   SetQuery i = new SetQuery();
         
   DAO.DAOParticipantes DAOPart = new DAO.DAOParticipantes();
   if(DAOPart.RetonaQTDClientes(i.LerTXT_Query(0)) == 1 )
   {
       lblSQL.setText("Alterando");
     DAOPart.AlteraDAOParticipantes(i.LerTXT_Query(1));
     System.out.print(" ----- Alterando\r\n");        
   }else
   {
       if(DAOPart.RetonaQTDClientes(i.LerTXT_Query(0)) < 1)
       {
            lblSQL.setText("Incluindo");
           DAOPart.SalvarDAOParticipantes(i.LerTXT_Query(2));
           System.out.print(" ------ Incluindo\r\n");
     
       }
   } 
   
}

O console mostra algum erro?

Nenhum erro ele executa todos os comandos que estou fazendo que mandei imprimir ocorre tudo certo menos esse metodo que não executa ja puis ele em classe tentei de tudo chamei ele dentro da classe que insiro os dados nada ocorre

Não

As condições do if estao sendo atendidas?

Estão, e está escrevendo no console de acordo com o codigo menos a lblSQL.setText(“Alterando”); que não funciona

Você esta add o lblSQL na interface?

to usando ela no Jframe na Interface

Pois é @Felipe_Martins1, voce esta fazendo isso?

JFrame f = new JFrame
f.getContentPane().add(lblSQL);

Não isso ai não, eu coloco no construtor ? ou no metodo mesmo ?

Não deu certo assim notei o seguinte, Estou chamando o pelo formulario pela classe System tray
quando executo o Frame Direto ele aparece mas quando chamo ele apartir do tray não da certo faz tudo menos escrever no JLabel ou qualquer outro componente

Post o codigo para analise

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.channels.FileChannel;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import view.main;
/**
*

  • @author Administrador
    */
    public class JFPrincipal extends javax.swing.JFrame {

    public void Escrever() {

     try
     {
         
     view.JFPrincipal p = new JFPrincipal();
     p.getContentPane().add(lblSQL);
     
      lblSQL.setText("Alterando");
     }catch(Exception ex){}
    

    }

    /**

    • Creates new form JFPrincipal
      */
      public JFPrincipal() {
      initComponents();

      TrayIcon trayIcon = null;
      setLocationRelativeTo(null);

      Image imageIcon = Toolkit.getDefaultToolkit().getImage(“C:\imagens\18x18\Clock.png”);
      setIconImage((Image) imageIcon);
      }

    /**

    • This method is called from within the constructor to initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is always

    • regenerated by the Form Editor.
      */
      @SuppressWarnings(“unchecked”)
      //
      private void initComponents() {

      timer1 = new org.netbeans.examples.lib.timerbean.Timer();
      jTabbedPane1 = new javax.swing.JTabbedPane();
      jPanel1 = new javax.swing.JPanel();
      jButton1 = new javax.swing.JButton();
      jButton3 = new javax.swing.JButton();
      jLabel1 = new javax.swing.JLabel();
      txtDiretorio = new javax.swing.JTextField();
      btBuscar = new javax.swing.JButton();
      lblSQL = new javax.swing.JLabel();
      jPanel2 = new javax.swing.JPanel();
      jLabel2 = new javax.swing.JLabel();
      tfHost = new javax.swing.JTextField();
      jLabel3 = new javax.swing.JLabel();
      tfBanco = new javax.swing.JTextField();
      jLabel4 = new javax.swing.JLabel();
      tfUsuario = new javax.swing.JTextField();
      tfSenha = new javax.swing.JPasswordField();
      jLabel5 = new javax.swing.JLabel();
      jButton4 = new javax.swing.JButton();
      jButton5 = new javax.swing.JButton();
      jPanel3 = new javax.swing.JPanel();
      jLabel6 = new javax.swing.JLabel();
      jLabel8 = new javax.swing.JLabel();
      jButton6 = new javax.swing.JButton();
      jLabel9 = new javax.swing.JLabel();
      jLabel10 = new javax.swing.JLabel();
      jtfSenha = new javax.swing.JPasswordField();

      timer1.setDelay(4000L);
      timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
      public void onTime(java.awt.event.ActionEvent evt) {
      timer1OnTime(evt);
      }
      });

      setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
      setTitle(“RMSYS - SERVIDOR BD”);
      setResizable(false);
      addWindowStateListener(new java.awt.event.WindowStateListener() {
      public void windowStateChanged(java.awt.event.WindowEvent evt) {
      formWindowStateChanged(evt);
      }
      });
      addWindowListener(new java.awt.event.WindowAdapter() {
      public void windowClosing(java.awt.event.WindowEvent evt) {
      formWindowClosing(evt);
      }
      public void windowIconified(java.awt.event.WindowEvent evt) {
      formWindowIconified(evt);
      }
      public void windowOpened(java.awt.event.WindowEvent evt) {
      formWindowOpened(evt);
      }
      });

      jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

      jButton1.setText(“Linha1”);
      jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
      jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton1ActionPerformed(evt);
      }
      });

      jButton2.setText(“Linha2”);
      jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
      jButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton2ActionPerformed(evt);
      }
      });

      jButton3.setText(“Linha3”);
      jButton3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
      jButton3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton3ActionPerformed(evt);
      }
      });

      jLabel1.setText(“Diretório”);

      btBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/18x18/Search.png"))); // NOI18N
      btBuscar.setText(“Buscar”);
      btBuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
      btBuscar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      btBuscarActionPerformed(evt);
      }
      });

      lblSQL.setBackground(new java.awt.Color(255, 255, 255));
      lblSQL.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
      lblSQL.setText(“SQL”);

      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()
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(lblSQL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jLabel1)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(txtDiretorio, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addComponent(jButton1)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(jButton2)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(jButton3)))
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(btBuscar)))
      .addGap(0, 103, Short.MAX_VALUE)))
      .addContainerGap())
      );
      jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(22, 22, 22)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jButton1)
      .addComponent(jButton2)
      .addComponent(jButton3))
      .addGap(18, 18, 18)
      .addComponent(jLabel1)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(txtDiretorio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addComponent(btBuscar))
      .addGap(31, 31, 31)
      .addComponent(lblSQL)
      .addContainerGap(253, Short.MAX_VALUE))
      );

      jTabbedPane1.addTab(“Inicio”, jPanel1);

      jLabel2.setText(“Host”);

      jLabel3.setText(“Nome do Banco”);

      jLabel4.setText(“Usuário”);

      jLabel5.setText(“Senha”);

      jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/18x18/Save.png"))); // NOI18N
      jButton4.setText(“Salvar”);
      jButton4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
      jButton4.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton4ActionPerformed(evt);
      }
      });

      jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/18x18/Delete.png"))); // NOI18N
      jButton5.setText(“Cancelar”);
      jButton5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

      javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
      jPanel2.setLayout(jPanel2Layout);
      jPanel2Layout.setHorizontalGroup(
      jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel2Layout.createSequentialGroup()
      .addContainerGap()
      .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
      .addComponent(jLabel2)
      .addComponent(tfHost)
      .addComponent(jLabel3)
      .addComponent(tfBanco, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE))
      .addComponent(jLabel4)
      .addComponent(jLabel5)
      .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
      .addComponent(tfSenha, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
      .addComponent(tfUsuario, javax.swing.GroupLayout.Alignment.LEADING)))
      .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
      .addContainerGap(262, Short.MAX_VALUE)
      .addComponent(jButton5)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(jButton4)
      .addContainerGap())
      );
      jPanel2Layout.setVerticalGroup(
      jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel2Layout.createSequentialGroup()
      .addGap(25, 25, 25)
      .addComponent(jLabel2)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(tfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(jLabel3)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(tfBanco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(jLabel4)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(tfUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addComponent(jLabel5)
      .addGap(14, 14, 14)
      .addComponent(tfSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 148, Short.MAX_VALUE)
      .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jButton4)
      .addComponent(jButton5))
      .addContainerGap())
      );

      jTabbedPane1.addTab(“Banco de dados”, jPanel2);

      jLabel6.setFont(new java.awt.Font(“Tahoma”, 0, 36)); // NOI18N
      jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/IconRmsys.png"))); // NOI18N

      jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      jLabel8.setText(“Senha”);

      jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/18x18/Apply.png"))); // NOI18N
      jButton6.setText(“OK”);
      jButton6.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton6ActionPerformed(evt);
      }
      });

      jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/login.png"))); // NOI18N

      jtfSenha.setFont(new java.awt.Font(“sansserif”, 0, 14)); // NOI18N
      jtfSenha.setEchoChar(‘R’);
      jtfSenha.addKeyListener(new java.awt.event.KeyAdapter() {
      public void keyPressed(java.awt.event.KeyEvent evt) {
      jtfSenhaKeyPressed(evt);
      }
      });

      javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
      jPanel3.setLayout(jPanel3Layout);
      jPanel3Layout.setHorizontalGroup(
      jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGap(68, 68, 68)
      .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
      .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addComponent(jLabel10)
      .addGap(27, 27, 27)
      .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
      .addComponent(jtfSenha, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
      .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGap(188, 188, 188)
      .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
      .addGap(272, 272, 272)
      .addComponent(jLabel9)
      .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
      );
      jPanel3Layout.setVerticalGroup(
      jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGap(16, 16, 16)
      .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGap(28, 28, 28)
      .addComponent(jLabel8)
      .addGap(18, 18, 18)
      .addComponent(jtfSenha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))))
      .addGroup(jPanel3Layout.createSequentialGroup()
      .addGap(204, 204, 204)
      .addComponent(jLabel9)))
      .addGap(43, 43, 43)
      .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addContainerGap(85, Short.MAX_VALUE))
      );

      jTabbedPane1.addTab(“Desbloqueio”, jPanel3);

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 464, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 450, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
      );

      pack();
      }//

    private void formWindowIconified(java.awt.event.WindowEvent evt) {

    System.out.print(“Minimizei”);

    this.hide();

    }

    private void formWindowStateChanged(java.awt.event.WindowEvent evt) {

    }
    private void formWindowOpened(java.awt.event.WindowEvent evt) {

     System.out.print("Executei aqui!!");
    

    }

    public void PegaDados()
    {
    timer1.start();
    }
    public void Buscar()
    {
    try {
    JFileChooser chooser = new JFileChooser();
    chooser.showOpenDialog(btBuscar);
    File file = chooser.getSelectedFile();

         String l = file.getAbsolutePath();
         //caminho da imagem e nome
         String caminhoImagem =  l;
    
         FileInputStream fisDe = new FileInputStream(l);
         FileOutputStream fisPara = new FileOutputStream(caminhoImagem);
    
         FileChannel fcPara = fisDe.getChannel();
         FileChannel fcDe = fisPara.getChannel();
         txtDiretorio.setText(caminhoImagem);
    
         if (fcPara.transferTo(0, fcPara.size(), fcDe) == 0L) {
             fcPara.close();
             fcDe.close();
         }
    
     } catch (Exception e) {
    
         JOptionPane.showMessageDialog(null, e);
     }
    

    }

    private void timer1OnTime(java.awt.event.ActionEvent evt) {

    SetQuery i = new SetQuery();
      evt.getActionCommand().startsWith("Escrever");
    DAO.DAOParticipantes DAOPart = new DAO.DAOParticipantes();
    if(DAOPart.RetonaQTDClientes(i.LerTXT_Query(0)) == 1 )
    {
        Escrever();
       
      DAOPart.AlteraDAOParticipantes(i.LerTXT_Query(1));
      System.out.print(" ----- Alterando\r\n");        
    }else
    {
        if(DAOPart.RetonaQTDClientes(i.LerTXT_Query(0)) < 1)
        {
             lblSQL.setText("Incluindo");
            DAOPart.SalvarDAOParticipantes(i.LerTXT_Query(2));
            System.out.print(" ------ Incluindo\r\n");
      
        }
    }       
    

    }

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
    try{
    EscreverNoArquivo();
    JOptionPane.showMessageDialog(rootPane,“Dados salvos com sucesso!”);
    }catch(Exception ex){JOptionPane.showMessageDialog(rootPane,“Erro: Verifique se existe o arquivo dados em c:/dados”);}
    }

    private void btBuscarActionPerformed(java.awt.event.ActionEvent evt) {
    Buscar();
    }

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
    SetQuery i = new SetQuery();
    JOptionPane.showMessageDialog(rootPane,i.LerTXT_Query(2));

    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    SetQuery i = new SetQuery();
    JOptionPane.showMessageDialog(rootPane,i.LerTXT_Query(1));

    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

     SetQuery i = new SetQuery();
     JOptionPane.showMessageDialog(rootPane,i.LerTXT_Query(0));
    

    }

    private void formWindowClosing(java.awt.event.WindowEvent evt) {
    JOptionPane.showMessageDialog(rootPane,“Atenção entre com usuário e senha para fechar o sistema!”);
    jTabbedPane1.setSelectedIndex(2);
    jtfSenha.requestFocusInWindow();
    }

    private void Login()
    {
    Model_Validacao.ModeloValidacao ModelVa = new Model_Validacao.ModeloValidacao();

     ModelVa.setpSenha(jtfSenha.getText());
            
     Controller_Validacao.ControllerValidacao ControllerVa = new Controller_Validacao.ControllerValidacao();
     
     ControllerVa.ValidaCampos(ModelVa.getpSenha());
    

    }
    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

     Login();
    

    }

    private void jtfSenhaKeyPressed(java.awt.event.KeyEvent evt) {
    if(evt.getKeyCode() == KeyEvent.VK_ENTER){
    Login();
    }
    }

    private void EscreverNoArquivo() throws IOException
    {
    // Gravando arquivo
    File arquivo;
    FileWriter arq = new FileWriter(“C:\dados.txt”);
    PrintWriter gravarArq = new PrintWriter(arq);
    arquivo = new File(“C:\dados.txt”); // Chamou e nomeou o arquivo txt.
    FileOutputStream fos;

      try {
            
      fos = new FileOutputStream(arquivo); // Perceba que estamos instanciando uma classe aqui. A FileOutputStream. Pesquise sobre ela!
       
      //DELIVERY COZINHA;
      String Host = "";
      Host = "\r\n"+Host;
      
      Host = tfHost.getText();    
      fos.write(Host.getBytes());   
     
      //DELIVERY SENHA
      String Banco = tfBanco.getText();
      
      Banco = "\r\n"+Banco;
      
      fos.write(Banco.getBytes()); 
      //DELIVERY VENDA
      String Usuario = tfUsuario.getText();
      
      Usuario = "\r\n"+Usuario;
      
      fos.write(Usuario.getBytes()); 
      //MESAS COZINHA
      String Senha = tfSenha.getText();
      
      Senha = "\r\n"+Senha;
      
      fos.write(Senha.getBytes()); 
    
      fos.close();  // Fecha o arquivo. Nunca esquecer disso.  
         
     } catch (FileNotFoundException ex) {
       
     }
    

    }
    /**

    • @param args the command line arguments
      /
      public static void main(String args[]) {
      /
      Set the Nimbus look and feel /
      //
      /
      If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

      • For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
        */
        try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
        if (“Nimbus”.equals(info.getName())) {
        javax.swing.UIManager.setLookAndFeel(info.getClassName());
        break;
        }
        }
        } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //

      /* Create and display the form */
      java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
      new JFPrincipal().setVisible(true);
      }
      });
      }

    // Variables declaration - do not modify
    private javax.swing.JButton btBuscar;
    private javax.swing.JButton jButton1;
    public static final transient javax.swing.JButton jButton2 = new javax.swing.JButton();
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JPasswordField jtfSenha;
    private javax.swing.JLabel lblSQL;
    private javax.swing.JTextField tfBanco;
    private javax.swing.JTextField tfHost;
    private javax.swing.JPasswordField tfSenha;
    private javax.swing.JTextField tfUsuario;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    private javax.swing.JTextField txtDiretorio;
    // End of variables declaration
    }

Pelo que pude entender aqui, você deve chamar o método “PegaDados” dentro do System tray.
Ou em algum lugar que queria executa-lo, como dentro do metodo Buscar().

No código que me passou você não chama ele em nenhum lugar.

1 curtida

campelo.m já consegui resolver obrigado pela ajuda

Post a solução, para conhecimento futuro de quem passar pelo mesmo problema.

Basicamente foi isso que vc falou mesmo quando eu vi vc tinha respondido basicamente oque eu fiz então sua resposta foi correta obrigado