1btnClear.addSelectionListener(new SelectionAdapter()
2 {
3 @Override
4 public void widgetSelected(SelectionEvent e)
5 {
6 textBox1.setText("");
7 textBox2.setText("");
8 }
9 });
10
1JButton b = new JButton("Clear");
2b.addActionListener(new ActionListener(){
3 public void actionPerformed(ActionEvent e){
4 textfield.setText("");
5 //textfield.setText(null); //or use this
6 }
7});