b1.addActionListener (new ActionListener (){
public void actionPerformed(ActionEvent e)
{
try{
String h = null,h1=null,h2=null;
if(t2.getText()!=null )
{
resultado=comando.executeQuery("select nome,cpf,matricula from aluno where Id='"+t2.getText()+"'");
if(resultado.next())
{
h=resultado.getObject(1).toString();
h1=resultado.getObject(2).toString();
h2=resultado.getObject(3).toString();
System.out.println(h+" "+h1+" "+h2);
t1.setText(h);t4.setText(h1);t3.setText(h2);
}
}
if(t1.getText()!=null )
{
resultado=comando.executeQuery("select Id,cpf,matricula from aluno where nome='"+t1.getText()+"'");
if(resultado.next())
{
h=resultado.getObject(1).toString();
h1=resultado.getObject(2).toString();
h2=resultado.getObject(3).toString();
System.out.println(h+" "+h1+" "+h2);
t2.setText(h);t4.setText(h1);t3.setText(h2);
}
}
if(t4.getText()!=null )
{
resultado=comando.executeQuery("select nome,Id,matricula from aluno where cpf='"+t4.getText()+"'");
if(resultado.next())
{
h=resultado.getObject(1).toString();
h1=resultado.getObject(2).toString();
h2=resultado.getObject(3).toString();
t1.setText(h);t2.setText(h1);t3.setText(h2);
}
}
if(t3.getText()!=null )
{
resultado=comando.executeQuery("select nome,Id,cpf from aluno where matricula='"+t3.getText()+"'");
if(resultado.next())
{
h=resultado.getObject(1).toString();
h1=resultado.getObject(2).toString();
h2=resultado.getObject(3).toString();
t1.setText(h);t2.setText(h1);t4.setText(h2);
}
}
else
System.out.println("bah");
}
catch(Exception e1)
{
JOptionPane.showMessageDialog(null, "O aluno nÃo esta cadastrado no banco!");
e1.printStackTrace();
}
}});
t1.getText() //nome
t2.getText() //ra
t3.getText() //numero carne
t4.getText() //cpf
obg
