Check for truncation of displayed text (Java, Swing)
Last edited on
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).
The 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.
We would like to use Google Analytics to get a better understanding of how
you use the website.
By agreeing to this, your usage data will be stored in the USA and processed
by Google LLC. Both Google as well as federal US agencies can access this data
and combine it with any other data about you, such as your search history,
personal accounts or any other data known to Google.