#35 wip
[fanfix.git] / src / jexer / TWindow.java
index 16945496e1f792d526240f3982aca67fc0f8a6a9..77bd2b31544fe39f9f5f063a4f15df3ce343d66d 100644 (file)
@@ -32,9 +32,9 @@ import java.util.HashSet;
 import java.util.Set;
 
 import jexer.backend.Screen;
-import jexer.bits.Cell;
 import jexer.bits.CellAttributes;
 import jexer.bits.GraphicsChars;
+import jexer.bits.StringUtils;
 import jexer.event.TCommandEvent;
 import jexer.event.TKeypressEvent;
 import jexer.event.TMenuEvent;
@@ -887,10 +887,11 @@ public class TWindow extends TWidget {
             true);
 
         // Draw the title
-        int titleLeft = (getWidth() - title.length() - 2) / 2;
+        int titleLength = StringUtils.width(title);
+        int titleLeft = (getWidth() - titleLength - 2) / 2;
         putCharXY(titleLeft, 0, ' ', border);
-        putStringXY(titleLeft + 1, 0, title);
-        putCharXY(titleLeft + title.length() + 1, 0, ' ', border);
+        putStringXY(titleLeft + 1, 0, title, border);
+        putCharXY(titleLeft + titleLength + 1, 0, ' ', border);
 
         if (isActive()) {
 
@@ -1187,6 +1188,7 @@ public class TWindow extends TWidget {
     /**
      * Activate window (bring to top and receive events).
      */
+    @Override
     public void activate() {
         application.activateWindow(this);
     }
@@ -1195,6 +1197,7 @@ public class TWindow extends TWidget {
      * Close window.  Note that windows without a close box can still be
      * closed by calling the close() method.
      */
+    @Override
     public void close() {
         application.closeWindow(this);
     }