|Other Swing Changes|
New class InputVerifier
The purpose of this class is to help clients support smooth focus navigation through GUIs with text fields. Such GUIs often need to ensure that the text entered by the user is valid (for example, that it's in the proper format) before allowing the user to navigate out of the text field. To do this, clients create a subclass of InputVerifier and, using JComponent's
setInputVerifiermethod, attach an instance of their subclass to the JComponent whose input they want to validate. Before focus is transfered to another Swing component that requests it, the input verifier's
shouldYieldFocusmethod is called. Focus is transfered only if that method returns
Sometimes a component, such as a Cancel button or a scroll bar, should receive the focus even if input is invalid. To enable this, invoke
setVerifyInputWhenFocusTarget(false)on the component.
The API change consists of a new abstract class, InputVerifier, and four new methods added to JComponent.
New methods in JComponent:
|firstname.lastname@example.org. This is not a subscription list.||