Im trying to implement "Clear" JMenuItem(to Clear Content of a JTextField) in my JMenuBar,that checks if textfield has any content after which the Clear menu gets enabled,If TextField has no content Clear JMenuItem gets Disabled. Is there any Listener that can help me do so?
Your menu action could be an AbstractAction (then it can be used in a menu or button). And you could use a DocumentListener added to your JTextField's Document, that responds by calling setEnabled(...)
on the AbstractAction, depending on whether the Document is empty or not.