-
Enhancement
-
Resolution: Unresolved
-
P4
-
8
-
x86_64
-
windows_7
A DESCRIPTION OF THE REQUEST :
The new datetime api really works much better than the previous. Even at a connection to the jdbc interface was intended. Unfortunately, the api can not be used by some of the swing components. For example, the new DateTimeFormatter is not yet accepted by the JFormattedTextField. An extension of the component would certainly be helpful.
JUSTIFICATION :
If you refactor your application or write a new one only using the new date and time api (JSR-310), you also have to consider your human interaction interface (i.e. your swing components).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFormattedTextField accepts DateTimeFormatter as input in one of its Constructors and uses it as formatter for the input.
ACTUAL -
There is no support for the new DateTimeFormatter in JFormattedTextFields.
---------- BEGIN SOURCE ----------
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE;
JFormattedTextField tf = new JFormattedTextField(formatter);
System.out.println(tf.getText());
tf.setText(formatter.format(LocalDate.now()));
LocalDate date = (LocalDate) tf.getValue();
System.out.println(date);
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use the old Formatters and date time classes in JFormattedTextFields and convert the Date objects to LocalDates.
Use JTextfield with an InputVerifier that uses the new DateTimeFormatter to verify the input.
The new datetime api really works much better than the previous. Even at a connection to the jdbc interface was intended. Unfortunately, the api can not be used by some of the swing components. For example, the new DateTimeFormatter is not yet accepted by the JFormattedTextField. An extension of the component would certainly be helpful.
JUSTIFICATION :
If you refactor your application or write a new one only using the new date and time api (JSR-310), you also have to consider your human interaction interface (i.e. your swing components).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFormattedTextField accepts DateTimeFormatter as input in one of its Constructors and uses it as formatter for the input.
ACTUAL -
There is no support for the new DateTimeFormatter in JFormattedTextFields.
---------- BEGIN SOURCE ----------
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE;
JFormattedTextField tf = new JFormattedTextField(formatter);
System.out.println(tf.getText());
tf.setText(formatter.format(LocalDate.now()));
LocalDate date = (LocalDate) tf.getValue();
System.out.println(date);
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use the old Formatters and date time classes in JFormattedTextFields and convert the Date objects to LocalDates.
Use JTextfield with an InputVerifier that uses the new DateTimeFormatter to verify the input.