how to clear text fields in java

Solutions on MaxInterview for how to clear text fields in java by the best coders in the world

showing results for - "how to clear text fields in java"
Sophie
04 Jan 2017
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});