ok desculpa pela informação não passada direito…
então até ai eu sei ir tranquilo o problema é que nao estou conseguindo jogar esta informação por exemplo em uma JTextField`
package br.com.Sistema.telas;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import br.com.Sistema.dal.ModuloConexao;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.awt.event.ActionEvent;
import br.com.Sistema.dal.ModuloConexao;
import br.com.Sistema.telas.TelaAcendedor55g;
public class ControleEstoque extends JInternalFrame {
Connection conexao = null;
PreparedStatement pst = null;
ResultSet rs = null;
/**
* Create the frame.
*/
public ControleEstoque() {
conexao = ModuloConexao.conector();
setMaximizable(true);
setIconifiable(true);
setClosable(true);
setBounds(0, 0, 600, 440);
getContentPane().setLayout(null);
//BOTAO QUE IRA CHAMAR A OUTRA TELA JA COM O VALOR DO BANCO DE DADOS
JButton btnAcendedorg = new JButton("Acendedor 55g");
btnAcendedorg.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
TelaAcendedor55g tela = new TelaAcendedor55g();
getParent().add(tela);
tela.setVisible(true);
}
});
btnAcendedorg.setBounds(50, 93, 148, 48);
getContentPane().add(btnAcendedorg);
}
}
package br.com.Sistema.telas;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JTextField;
import br.com.Sistema.dal.ModuloConexao;
ESTE JFRAME DEBAIXO E O QUE EU QUERO JA ESTEJA IMPRIMDO O VALOR DO BANCO E NAO SEI COMO CHAMA-LO…
public class TelaAcendedor55g extends JInternalFrame {
public static JTextField txtAcen55g;
Connection conexao = null;
PreparedStatement pst = null;
ResultSet rs = null;
public TelaAcendedor55g() {
setMaximizable(true);
setIconifiable(true);
setClosable(true);
conexao = ModuloConexao.conector();
setBounds(0, 0, 600, 440);
getContentPane().setLayout(null);
JLabel lblAcen = new JLabel("Acendedor 55g");
lblAcen.setFont(new Font("Tahoma", Font.BOLD, 19));
lblAcen.setBounds(61, 115, 154, 33);
getContentPane().add(lblAcen);
txtAcen55g = new JTextField();
txtAcen55g.setBounds(235, 115, 250, 33);
getContentPane().add(txtAcen55g);
txtAcen55g.setColumns(10);
}
// TENTATIVA DE FAZER O METODO SEM SUCESSO
//MINHA DUVIDA TAMBÉM É EU FAÇO ESSE METODO AQUI NESTE TELA OU NA TELA CONTROLE DE ESTOQUE
private void pesquisar_clientes() {
String sql = "select sum(quant_receb) as Valor_Total from recebimento where id_fornec = 2 ";
try {
pst = conexao.prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()) {
txtAcen55g.setText(rs.getString(2));
conexao.close();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
e.printStackTrace(System.out);
}
}
}