RFR: 8351047: TitledPane should handle titles that are resizable

John Hendrikx jhendrikx at openjdk.org
Wed Mar 26 20:04:19 UTC 2025


On Wed, 26 Mar 2025 19:20:54 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java line 514:
>> 
>>> 512:              */
>>> 513: 
>>> 514:             double labelPrefWidth = TitledPaneSkin.super.computePrefWidth(height, 0, 0, 0, 0);
>> 
>> On a related subject: trying to get the title label truncated (using the code sample in the ticket) did not succeed even though the TitledPane is a Labeled:
>> 
>> 
>>         TitledPane tp1 = new TitledPane("Left Aligned Title with a long long title with ellipses set", ...);
>>         tp1.setPrefWidth(100);
>>         tp1.setMaxWidth(100);
>>         tp1.setEllipsisString("...");
>> 
>> 
>> This seems like a possible bug to me.  What do you think?
>
> created https://bugs.openjdk.org/browse/JDK-8352991

Yeah, this problem likely stems from the substructure of the titled pane.  It has a content and title area, but no `VBox` wrapper around those that will do correct calculations. The calculations are just done manually, and they completely ignore many nuances of the layout system.

If `TitledPane` had been based on `VBox` it might have been easier to get correct.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1742#discussion_r2014918983


More information about the openjfx-dev mailing list