原因确实是测量所有单元格的pref宽度,因为(不是公开的!)记录在ComboBoxListViewSkin中:
// By default we measure the width of all cells in the ListView. If this
// is too burdensome, the developer may set a property in the ComboBox
// properties map with this key to specify the number of rows to measure.
// This may one day become a property on the ComboBox itself.
private static final String COMBO_BOX_ROWS_TO_MEASURE_WIDTH_KEY = "comboBoxRowsToMeasureWidth";
解决方法是限制应该测量的行数-没有保证,因为没有公共文档根本就没有规范:
comboBox1.getProperties().put("comboBoxRowsToMeasureWidth", 10);
最初仍然大量调用updateItem,这至少是测量(填充和释放)期间给定限制的两倍,加上一次用于设置实际值。