Is it possible to truncate a Label or a Text after a fixed number of lines in JavaFX? For the Web there is a CSS property called 'line-clamp'. Unfortunately there doesn't seem to be an equivalent in JavaFX.
With a Label you can either choose to wrap the text or truncate it with ellipsis shown. With the Text object it is at least possible to specify the wrapping with.
Not wrapped and not truncated:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eir mod tempor invidunt ut labore et dolore magna aliquyam
Wrapped and not truncated:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam
Not wrapped and truncated:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
Wrapped and truncated after 2 lines (desired behavior):
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore ...
