Skip to content

Calling SwingUtilities.updateComponentTreeUI() on an RTextArea with a changed font resets it to default. #592

@Chr1sps

Description

@Chr1sps

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:

  1. Create a new RTextArea.
  2. Call the setFont(Font) method with a different font.
  3. 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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions