RFR: 8092102: Labeled: truncated property [v2]
Andy Goryachev
angorya at openjdk.org
Tue Mar 5 21:04:01 UTC 2024
On Tue, 5 Mar 2024 14:16:59 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>>
>> - review comments
>> - Merge remote-tracking branch 'origin/master' into 8092102.truncated
>> - 8092102 Labeled: truncated property
>
> modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java line 850:
>
>> 848: protected boolean computeValue() {
>> 849: if (isWrapText()) {
>> 850: return false;
>
> Are you sure that allowing text to wrap necessarily means it won't be truncated? What if the max height doesn't allow another line?
Good point. So the label will have its text truncated (by inserting the ellipsis string) when wrapText is on and the size is constrained by setting maxHeight.
Interestingly, it will not truncate the text (again, ellipsis string) if the label is resized by the layout:

Using the latest MonkeyTester to test
https://github.com/andy-goryachev-oracle/MonkeyTest
uncomment the listener in LabelPage
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1513493586
More information about the openjfx-dev
mailing list