X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTMessageBox.java;h=6f1e8a69486b05141b085bda4b841ba474aef347;hb=58701825851d5533ec28b0ecd6c0c5ed645655c5;hp=1eff8a7613ef120ef1b88428931d60fa18d7fc48;hpb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;p=nikiroo-utils.git diff --git a/src/jexer/TMessageBox.java b/src/jexer/TMessageBox.java index 1eff8a7..6f1e8a6 100644 --- a/src/jexer/TMessageBox.java +++ b/src/jexer/TMessageBox.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; +import jexer.bits.StringUtils; import jexer.event.TKeypressEvent; import static jexer.TKeypress.*; @@ -41,7 +42,7 @@ import static jexer.TKeypress.*; * *
* {@code - * box = application.messageBox(title, caption, + * box = messageBox(title, caption, * TMessageBox.Type.OK | TMessageBox.Type.CANCEL); * * if (box.getResult() == TMessageBox.OK) { @@ -187,11 +188,11 @@ public class TMessageBox extends TWindow { // Determine width and height String [] lines = caption.split("\n"); - int width = title.length() + 12; + int width = StringUtils.width(title) + 12; setHeight(6 + lines.length); for (String line: lines) { - if (line.length() + 4 > width) { - width = line.length() + 4; + if (StringUtils.width(line) + 4 > width) { + width = StringUtils.width(line) + 4; } } setWidth(width);