如何在 install4j 中动态填充下拉列表?

How do I dynamically populate a drop-down list in install4j?

我无法弄清楚如何在 install4j 中的表单上填充下拉列表。我有自定义代码,其中 returns 一个 String[],并将一个变量设置为此值。一切正常。

对于下拉和组合框组件的帮助,说明如下:

The items in the drop-down list as a list separated by semicolons. The items in the list must be separated by semicolons followed by a space. If you click on the edit button in the property editor, you can enter one item per line in a separate dialog. Items that are installer variables with array values (e.g. String[], Object[] or File[]) are expanded as separate items, this allows you to build a variable length list of items at runtime.

这意味着我只需在项目列表中添加我的安装程序变量即可。但这显示为文字文本。我应该用代码设置列表选项吗?

参见:http://resources.ej-technologies.com/install4j/help/doc/index.html

如果名为 "listItems" 的安装程序变量设置为

new String[] {"One", "Two", "Three"}

并且 "Drop-down list" 表单组件的 "Drop-down list entries" 属性 设置为

${installer:listItems}

那么下拉列表将包含三个条目。