On Sun, 22 Mar 2026 21:50:28 GMT, Phil Race <[email protected]> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with two
>> additional commits since the last revision:
>>
>> - Fix
>> - Fix
>
> src/java.desktop/share/classes/javax/swing/JFormattedTextField.java line 545:
>
>> 543: */
>> 544: public Object getValue() {
>> 545: if (value instanceof DateTimeFormatter formatter) {
>
> This looks odd. Surely the value field stores a LocalDate not text ?
> Otherwise how do all the other types work ?
As I see the other types like say NumberFormatter sets the value like this
NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
format.setMaximumFractionDigits(0);
NumberFormatter fmt = new NumberFormatter(format);
JFormattedTextField ftf = new JFormattedTextField(fmt);
ftf.setValue(.34);
whereas as per the reproducer uses setText for the DateTimeFormatter like
`tf.setText(formatter.format(LocalDate.now()));`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30292#discussion_r2973231869