clear text field in java

Solutions on MaxInterview for clear text field in java by the best coders in the world

showing results for - "clear text field in java"
Mandy
29 Apr 2019
1btnClear.addSelectionListener(new SelectionAdapter()
2  {
3    @Override
4    public void widgetSelected(SelectionEvent e)
5    {
6      textBox1.setText("");
7      textBox2.setText("");
8     }
9  });
10
Morris
29 Mar 2019
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});