This example shows how to check whether the text shown in a JComponent (or a subclass of JComponent) has been truncated (e.g., because it is wider than the width of the GUI control).
is_truncated_swing() function compares the widget’s actual width (from its
width property), with the number of pixels needed to display the entire text (returned by the
requiredWidth() function), and calls Squish’
test.fail() function if the actual width is less than the required width.