Answers for "how to clear a textfield in java"

1

clear text field in java

btnClear.addSelectionListener(new SelectionAdapter()
  {
    @Override
    public void widgetSelected(SelectionEvent e)
    {
      textBox1.setText("");
      textBox2.setText("");
     }
  });
Posted by: Guest on December-09-2020
0

how to clear text fields in java

JButton b = new JButton("Clear");
b.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        textfield.setText("");
        //textfield.setText(null); //or use this
    }
});
Posted by: Guest on August-05-2020

Code answers related to "how to clear a textfield in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language