For example, if component is a checkbox it must set to false, or it is a textfield it must be clear the text. I am trying to write a method for reset all components in a JPanel. It must work like reset function in HTML forms.
How to reset a JComponent to the default value?
One possible workaround would be to create a custom reset function. Reinitialize the panel ( your form).
For e.g.
Create a custom class
FormPanelto store the form fields and their listeners.Re initializing the panel components would result in an overhead of reassigning the listeners as @Robin suggested.