In my application, i have made one JButton, named "Clear", i have placed its handler named ClearHandler in other file with ClearHandler.java. The functionality of the handler is, whenever button is pressed, it should clear all the textfields. For which, i have used following code:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
class ClearHandler extends GUIApps implements ActionListener{
public void actionPerformed(ActionEvent e){
String s="";
idfield.setText(s);
descfield.setText(s);
ratefield.setText(s);
quantfield.setText(s);
unitfield.setText(s);
System.out.print("Event:="+e.getActionCommand());
}
}
i am not able to get the functionality. after pressing button, i am getting on console, "Event: Clear", but no textfield is getting cleared. Please provide solution.