更新时间:2023-01-24 17:31:06
根据您使用的jdk8的确切(更新)版本,这可能是 RT-25679 (部分还原于 RT-38517 )AFAIK,没有公共API可以禁用集合视图的自动对焦/选择。只有ListView在其属性中禁用默认行为(未记录!注意,它们可以更改,恕不另行通知)条目
Depending on which exact (update) version of jdk8 you are using, this might be the fix for RT-25679 (partially reverted in RT-38517) AFAIK, there is no public api to disable the auto-focus/select for the collection views in general. Only ListView has (undocumented! beware, they can change without notice) entries in its properties that disable the default behaviour
// disable selecting the first item on focus gain - this is
// not what is expected in the ComboBox control (unlike the
// ListView control, which does this).
listView.getProperties().put("selectOnFocusGain", false);
// introduced between 8u20 and 8u40b7
// with this, testfailures back to normal
listView.getProperties().put("selectFirstRowByDefault", false);