getFormattedDateWidthInPixels
public static int getFormattedDateWidthInPixels(java.time.format.DateTimeFormatter formatCE,
Locale locale,
Font fontValidDate,
int numberOfExtraCharacters)
getFormattedDateWidthInPixels, This returns the width (in pixels) of the longest formatted
date, using the supplied DateTimeFormatter instance, locale, and font.
The month that will be used for the length calculation will be the "longest text month"
according to the function getLongestTextMonthInLocale().
You may optionally add extra characters to the longestDateString that is used in the
calculation, by supplying a nonzero value for the parameter numberOfExtraCharacters.
formatCE: This is the date format that should be used in the calculation. Longer (wider)
formats will result in wider printed dates.
locale: This is the locale that you wish to use in the calculation. The width of the date
string (and the width of the month names) will be different depending on the locale that is
used to translate and format the date.
fontValidDate: This will be used to generate the font metrics for the calculation. Larger
font types, and larger font sizes, will result in wider printed dates.
numberOfExtraCharacters: This is the number of "extra" characters that you want to have used
in calculating the width of the longest formatted date. If you don't wish for any extra
characters to be used in the calculation, please supply zero for this value. If you wish to
-shorten- the default date string, you may also supply a negative number of characters for
this value.
Implementation details: Note that any formatted date could be made longer by using years
greater than four digits, or by using BC years. This function assumes four digit Common Era
years, in performing its calculations.