Description
Calling SwingUtilities.updateComponentTreeUI(Component) on an RTextArea object with a changed font resets the font to the default.
Steps to Reproduce
Specific steps to reproduce the behavior:
- Create a new RTextArea.
- Call the
setFont(Font) method with a different font.
- Call
SwingUtilities.updateComponentTreeUI(Component) on the object (or any of it's ancestors).
Expected behavior
The text area font set before stays the same after calling the SwingUtilities.updateComponentTreeUI(Component) method.
Actual behavior
The text area font is reset to the default.
Library version
3.5.2
Java version
Oracle OpenJDK 21.0.3 (build 21.0.3+7-LTS-152)
Additional context
The issue seems to be caused by the RTextArea.setUI(TextUI) method making the text area UI install the defaults (as seen here).
I don't know if the font resetting behaviour I described here is desired, but given that it's impossible to override it due to the RTextArea.setUI(TextUI) method being final, it would be nice if there was at least a way to override it in case it is desired.