Q: Labeled.textTruncated Property (RFE)

Daniel Peintner daniel.peintner at gmail.com
Wed Mar 6 07:53:38 UTC 2024


Hi Andy, all,

Thank you for the effort which I very much appreciate.
We have a similar use-case as the one mentioned in JDK-8205211.

We would like to show a Tooltip with the corresponding text once the text
is shown with ellipsis for a TableCell. The *hacky* solution we are using
is sketched in [1] and requires us to calculate the width again. Moreover,
once different fonts come into the game it becomes even more brittle.

Having an easy (easier?) way to detect and observe whether a label is
truncated is of importance for us and definitely improves the usability of
JavaFX.

Thanks,

-- Daniel

[1] https://stackoverflow.com/a/52432862

On Tue, Mar 5, 2024 at 10:15 PM Andy Goryachev <andy.goryachev at oracle.com>
wrote:

> Dear colleagues:
>
>
>
> Do you think a new property, *ReadOnlyBooleanProperty textTruncated*,
> should be added to the Labeled control?
>
>
>
>
>
> On one hand, we do have a couple of tickets in JBS requesting that:
>
>
>
>    - JDK-8091891 <https://bugs.openjdk.org/browse/JDK-8091891> TreeView:
>    There is no tooltip available on truncated node
>    - JDK-8205211 <https://bugs.openjdk.org/browse/JDK-8205211> Ability to
>    show Tooltip only when text is shown with ellipsis (...)
>
>
>
> On the other hand, this functionality can in theory be implemented at the
> application level, although the number of changes required might be
> uncomfortably large in the case of Tree/TreeTable/TableView.
>
>
>
> JBS:
>
>    - JDK-8092102 <https://bugs.openjdk.org/browse/JDK-8092102> Labeled:
>    truncated property
>
>
>
> Pull Request: https://github.com/openjdk/jfx/pull/1389
>
>
>
> What do you think?
>
>
>
> -andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240306/af87f629/attachment.htm>


More information about the openjfx-dev mailing list