X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTCalendar.java;h=580fb9f1c841d41189801e4b0dd71aa2ee78f624;hb=e820d5dd4e52a787e7f53f6409bb6ff334c3ef7b;hp=b5ecf4df4a3e4e381b7183a50ee0a444c03f6c99;hpb=9f613a0c54cb97e9305fd87ce8eb2f76ac82804e;p=fanfix.git diff --git a/src/jexer/TCalendar.java b/src/jexer/TCalendar.java index b5ecf4d..580fb9f 100644 --- a/src/jexer/TCalendar.java +++ b/src/jexer/TCalendar.java @@ -33,6 +33,7 @@ import java.util.GregorianCalendar; import jexer.bits.CellAttributes; import jexer.bits.GraphicsChars; +import jexer.bits.StringUtils; import jexer.event.TKeypressEvent; import jexer.event.TMouseEvent; import static jexer.TKeypress.*; @@ -238,10 +239,13 @@ public class TCalendar extends TWidget { // Draw the title String title = String.format("%tB %tY", displayCalendar, displayCalendar); - int titleLeft = (getWidth() - title.length() - 2) / 2; + // This particular title is always single-width (see format string + // above), but for completeness let's treat it the same as every + // other window title string. + int titleLeft = (getWidth() - StringUtils.width(title) - 2) / 2; putCharXY(titleLeft, 0, ' ', titleColor); putStringXY(titleLeft + 1, 0, title, titleColor); - putCharXY(titleLeft + title.length() + 1, 0, ' ', + putCharXY(titleLeft + StringUtils.width(title) + 1, 0, ' ', titleColor); // Arrows