2

Some JavaFX components support text ellipsizing when text width is wider then component width. For example, table cell. Is it possible to check if text is ellipsized?

For example, there is a table:

---------------------------------------
| This is a story abo...| Conan Doyle |
---------------------------------------

So I need to get true for the first cell and get false for the second.

Pavel_K
  • 10,748
  • 13
  • 73
  • 186
  • 1
    This may be a good place to start: https://stackoverflow.com/questions/16728134/javafx-tableview-column-width-contents-auto-truncating – SedJ601 Aug 11 '17 at 21:38
  • Have you tired [`isWrapText()`](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Labeled.html#isWrapText--)? – SedJ601 Aug 11 '17 at 21:47
  • @SedrickJefferson: *"If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line."* How does this help??? – fabian Aug 11 '17 at 22:33
  • I was just throwing out guesses. That's why I didn't create an answer. I assumed if this is how the node knows to wrap text, then it may also be how the node knows to when to ellipsize. Given `isWrapText()` and a non multi-line node. – SedJ601 Aug 11 '17 at 23:28
  • This looks promising: https://stackoverflow.com/questions/35012518/resize-javafx-label-if-overrun. That's assuming the `Label` and `TableCell` use the same approach. – SedJ601 Aug 11 '17 at 23:50
  • @fabian Please, remove this duplicate. That question is about tooltips this question about checking if text is ellipsized. For example I have a label and I need to check if its text is ellipsized (no any tooltips).I asked both these questions and its clear for me that they are different, although they are about ellipsized text. – Pavel_K Aug 12 '17 at 07:50
  • 1
    For tooltips to occur only when there is an ellipsis you need to check, if there is an ellipsis. In both questions your problem is the same! – fabian Aug 12 '17 at 07:52

0 Answers0