Nao consigo fazer com que um determinado botao limpe um textfield acontece erros de compilacao.
class Consulta extends JPanel {
public Consulta(String nome1,int size1,String nome2,String nome3) {
setBackground(Color.black);
setForeground(Color.green);
JLabel label1 = new JLabel(nome1);
label1.setFont(new Font("SansSerif",Font.PLAIN,11));
label1.setForeground(Color.green);
JTextField text1 = new JTextField(size1);
text1.setBackground(Color.black);
text1.setForeground(Color.green);
JButton botao = new JButton(nome2);
botao.setFont(new Font("SansSerif",Font.PLAIN,11));
botao.setBackground(Color.black);
botao.setForeground(Color.green);
JButton botao2 = new JButton(nome3);
JButton botao3 = new JButton("Limpar");
botao2.setForeground(Color.green);
botao2.setBackground(Color.black);
botao2.setFont(new Font("SansSerif",Font.PLAIN,11));
botao3.setBackground(Color.black);
botao3.setForeground(Color.green);
botao3.setFont(new Font("SansSerif",Font.PLAIN,11));
add(label1);
add(text1);
add(botao);
add(botao2);
botao3.addActionListener( new ActionListener() {
public void actionPerfomed(ActionEvent cancelar)
{
text1.setText("");
}
}
);
add(botao3);
}
}
Obrigado --------------------------------------------------
gatecrasher@linuxmail.org