Check if a label is ellipsized and then add a tooltip

Kevin Rushforth kevin.rushforth at oracle.com
Thu Feb 24 00:21:48 UTC 2022


I don't know of a way to determine whether the text of a labeled is 
currently being displayed truncated with ellipses. There isn't a 
(read-only) overrun or displayedText property, either of which would 
allow an app to know.

The only thing I can think of to work around this is to estimate the 
size that the text would need and compare it to the available size.

-- Kevin


On 2/23/2022 5:03 AM, Davide Perini wrote:
> Hi,
> I have a label inside a gridpane.
>
> It is possible to check if the label is ellipsized and if yes, add a 
> tootltip to let the user read the entire label when overing the label 
> with the mouse?
>
> Thanks
> Davide



More information about the openjfx-dev mailing list