X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fcache%2FJvCacheableInputBox.java;h=e4e2d99e3e8d4dbcc8442eab96c229c7cb7d89d1;hb=ae73ba1b149dce528d3cba7fd9a4d20b7e50baa6;hp=9ec3a9f6658beb7e3554495317ab64961c935788;hpb=d27da609341db336cdda77a6cc880a6059d8a2d9;p=jalview.git diff --git a/src/jalview/io/cache/JvCacheableInputBox.java b/src/jalview/io/cache/JvCacheableInputBox.java index 9ec3a9f..e4e2d99 100644 --- a/src/jalview/io/cache/JvCacheableInputBox.java +++ b/src/jalview/io/cache/JvCacheableInputBox.java @@ -87,15 +87,26 @@ public class JvCacheableInputBox } /** - * Constructor + * Constructor given the key to cached values, and the (approximate) length in + * characters of the input field * * @param newCacheKey + * @param length */ - public JvCacheableInputBox(String newCacheKey) + public JvCacheableInputBox(String newCacheKey, int length) { // super(); cacheKey = newCacheKey; prototypeDisplayValue = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; + if (length > 0) + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; i++) + { + sb.append("X"); + } + setPrototypeDisplayValue(sb.toString()); + } boolean useTextField = Platform.isJS(); // BH 2019.03 only switch for JavaScript here // SwingJS TODO implement editable combo box @@ -134,10 +145,10 @@ public class JvCacheableInputBox } }); comboBox.setPrototypeDisplayValue(prototypeDisplayValue); + initCachePopupMenu(); + initCache(newCacheKey); + updateCache(); } - initCachePopupMenu(); - initCache(newCacheKey); - updateCache(); } /** @@ -193,7 +204,7 @@ public class JvCacheableInputBox @Override public void actionPerformed(ActionEvent e) { - // System.out.println(">>>>> Clear cache items"); + // jalview.bin.Console.outPrintln(">>>>> Clear cache items"); setSelectedItem(""); appCache.deleteCacheItems(cacheKey); updateCache();