Package org.ka2ddo.yaac.gui.util
Class NonEmptyTextButtonEnabler
java.lang.Object
org.ka2ddo.yaac.gui.util.NonEmptyTextButtonEnabler
- All Implemented Interfaces:
EventListener
,DocumentListener
This class implements a generic listener for enabling and disabling a button
based on whether the associated text document contains text or not.
- Author:
- Andrew Pavlin, KA2DDO
-
Constructor Summary
ConstructorDescriptionCreate a document listener that will update the enabled state of a JComponent based on whether there is any text in the document.NonEmptyTextButtonEnabler
(JComponent comp, ButtonModel qualifyingModel) Create a document listener that will update the enabled state of a JComponent based on whether there is any text in the document.NonEmptyTextButtonEnabler
(JComponent comp, JToggleButton qualifyingButton) Create a document listener that will update the enabled state of a JComponent based on whether there is any text in the document. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Gives notification that an attribute or set of attributes changed.void
Gives notification that there was an insert into the document.void
Gives notification that a portion of the document has been removed.
-
Constructor Details
-
NonEmptyTextButtonEnabler
Create a document listener that will update the enabled state of a JComponent based on whether there is any text in the document.- Parameters:
comp
- JComponent whose enabled state should be updated
-
NonEmptyTextButtonEnabler
Create a document listener that will update the enabled state of a JComponent based on whether there is any text in the document.- Parameters:
comp
- JComponent whose enabled state should be updatedqualifyingModel
- ButtonModel used to indicate whether comp can be enabled
-
NonEmptyTextButtonEnabler
Create a document listener that will update the enabled state of a JComponent based on whether there is any text in the document.- Parameters:
comp
- JComponent whose enabled state should be updatedqualifyingButton
- JToggleButton used to indicate whether comp can be enabled
-
-
Method Details
-
insertUpdate
Gives notification that there was an insert into the document. The range given by the DocumentEvent bounds the freshly inserted region.- Specified by:
insertUpdate
in interfaceDocumentListener
- Parameters:
e
- the document event
-
removeUpdate
Gives notification that a portion of the document has been removed. The range is given in terms of what the view last saw (that is, before updating sticky positions).- Specified by:
removeUpdate
in interfaceDocumentListener
- Parameters:
e
- the document event
-
changedUpdate
Gives notification that an attribute or set of attributes changed.- Specified by:
changedUpdate
in interfaceDocumentListener
- Parameters:
e
- the document event
-