JAL-3490 merged with 2.11.2 develop
[jalview.git] / src / jalview / io / cache / JvCacheableInputBox.java
index 9ec3a9f..cd89ea9 100644 (file)
@@ -87,15 +87,26 @@ public class JvCacheableInputBox<E>
   }
 
   /**
-   * 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
@@ -135,6 +146,7 @@ public class JvCacheableInputBox<E>
       });
       comboBox.setPrototypeDisplayValue(prototypeDisplayValue);
     }
+    appCache = AppCache.getInstance();
     initCachePopupMenu();
     initCache(newCacheKey);
     updateCache();