JavaFX TextInputControl private access yet supposed to be overrided problem

Andy Goryachev andy.goryachev at oracle.com
Wed Jul 30 23:02:03 UTC 2025


Dear Tom:

Anything not public or protected is considered an implementation detail, inaccessible to the application by design.  There are many reasons for hiding the implementation detail, for example, any changes or bug fixes that do not change the public APIs can be done without breaking the existing applications.

The important question is - what is the exact functionality you are looking for?  What is your use case?  If there is something that can't be done with the use of public APIs, we might consider adding new APIs.  See, for instance, https://bugs.openjdk.org/browse/JDK-8300569

And yes, TextInputControlFromatterAccessor is a typo.  Good news: it's beyond the event horizon formed by the public APIs, and thus has no effect on the outside world.  You are absolutely right, we should rename it.

Thanks!
-andy


From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of tom L <tom_L64 at hotmail.com>
Date: Friday, July 25, 2025 at 11:11
To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: JavaFX TextInputControl private access yet supposed to be overrided problem
Hello.
I have this problem where a lot of methods and utility in TextInputControl have package private access while at the same time are expected to be used/overriden by children.
For example,
```
    String filterInput(String text) {
        // This method should be overridden by child classes.
        // It is overridden in TextField and TextArea as needed.
        return text;
    }
```
This method is clearly supposed to be overriden, and I am making a hex editor, requiring me to create my own text field, but I can't override it.
It is the same for other methods, also including utility methods, like for example, with the same name :
```
    static String filterInput(String txt, boolean stripNewlines, boolean stripTabs)
```
In order to do what I want, I am no choice but to copy paste half the code of this class, since even if I override the only method that uses filterInput, public void replaceText, there are a lot of package private stuff inside (mainly getFormatterAccessor), so I am ended up with trying to copy paste the whole class.

On another note, since I am talking about formatter accessor, this inner class in TextInputControl has a typos in it: TextInputControlFromatterAccessor.

Is it possible to fix this?
Thank you in advance.

Best regards,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250730/7816353d/attachment-0001.htm>


More information about the openjfx-dev mailing list