[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 5032471: JFormattedTextField does not use editformatter on initial focus with setText() [v2
From:       Alexey Ivanov <aivanov () openjdk ! org>
Date:       2023-07-28 19:49:50
Message-ID: ZCXmgqoaP02r2dLm4iSrW4Mz6QtVYS1R4Qy3-66cKX0=.384bc0ba-2544-40de-a682-02707f8227e5 () github ! com
[Download RAW message or body]

On Wed, 26 Jul 2023 03:26:02 GMT, Prasanta Sadhukhan <psadhukhan@openjdk.org> wrote:

> > The bug report mentions using `setDocument()` to change the value of the \
> > formatted text field. Also, it's possible to call `getDocument().setText()`, \
> > which may still have the original bug.
> 
> Fixed setDocument but I couldn't find Document.setText that can be called...

Sorry about it, `Document` uses `insertString` method. Perhaps, we shouldn't care \
about it, if you modify the text using the `Document` interface directly, you could \
lose the invariants that `JFormattedTextField` provides. The \
[javadoc](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/JFormattedTextField.html) \
also mentions, that you should not install your own `DocumentFilter` and \
`NavigationFilter`.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14993#issuecomment-1656235954


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic