do {
if(leitor.readLine()!=null){
tm = leitor.readLine();
ar = tm.split(";");
if (ar[0].equals(nome_consulta)) {
a = ar[0];
b = ar[1];
d = ar[2];
janela(a, b, d);
caso = true;
}
}
} while (leitor.readLine() != null);
public void janela(String nome1, String telefone1, String cpf1) {
this.setTitle("Consulta");
this.setSize(300, 157);
this.setLocationRelativeTo(null);
this.setResizable(false);
GridBagLayout layout = new GridBagLayout();
Container c = getContentPane();
GridBagConstraints cons = new GridBagConstraints();
c.setLayout(layout);
nome = new JTextField();
nome.setEditable(true);
nome.setBackground(Color.white);
n = new JLabel("Digite seu nome =");
telefone = new JTextField();
telefone.setEditable(true);
t = new JLabel("digite seu telefone =");
cpf = new JTextField();
cpf.setEditable(true);
cpf.setBackground(Color.white);
cp = new JLabel("Digite seu cpf =");
cons.fill = GridBagConstraints.BOTH;
cons.weightx = 0.25;
cons.weighty = 0.75;
cons.gridx = 0;//posiçao no eixo x horizontal
cons.gridy = 0;//posicao no eixo y vertical
c.add(n, cons);
cons.gridwidth = 2;
cons.gridx = 1;
cons.gridy = 0;
c.add(nome, cons);
cons.gridx = 0;
cons.gridy = 1;
c.add(t, cons);
cons.gridx = 1;
cons.gridy = 1;
c.add(telefone, cons);
cons.gridx = 0;
cons.gridy = 2;
c.add(cp, cons);
cons.gridx = 1;
cons.gridy = 2;
c.add(cpf, cons);
nome.setText(nome1);
telefone.setText(telefone1);
cpf.setText(cpf1);
}
}
if (e.getSource() == ok) {
try {
String cada_nome = nome.getText();
nome.setText("");
String tele_nome = telefone.getText();
telefone.setText("");
String cpf_nome = cpf.getText();
cpf.setText("");
String virgula = ";";
escreve=new BufferedWriter(saida = new FileWriter(texto, true));
escreve.write(cada_nome+";");
escreve.write(tele_nome+";");
escreve.write(cpf_nome+";");
escreve.close();
saida.close();
} catch (java.io.IOException ex) {
Logger.getLogger(File_Cadastro.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "erro");
}