![]() ![]() Java™ Web Start ( download JDK 7 or later). Click the Launch button to run FormattedTextFieldDemo using.This GUI uses formatted text fields to display numbers in four different formats. The input verifier enables you to check whether the value of the component is valid and optionally change it or stop the focus from being transferred. A component's input verifier is called when the component nearly loses the keyboard focus. A spinner uses a formatted text field by default, but adds two buttons that enable the user to choose a value in a sequence.Īnother alternative or adjunct to using a formatted text field is installing an If the possible values of a formatted text field have an obvious order, use a spinner instead. For example, you can specify a mask for typing phone numbers in a particular format, such as (XX) X-XX-XX-XX-XX. Another kind of formatter enables you to use a character mask to specify the set of characters that can be typed at each position in the field. ![]() Using the formatters that Swing provides, you can set up formatted text fields to type dates and numbers in localized formats. The formatter translates the field's value into the text it displays, and the text into the field's value. JFormattedTextField class adds a formatter and an object value to the features inherited from the JTextField class. Formatted text fields provide a way for developers to specify the valid set of characters that can be typed in a text field. ![]()
0 Comments
Leave a Reply. |