“No select item” on JavaFX combo box?

stay Combo@R_705_2419 @What is the correct way to place items with null values in?

Exception in thread "JavaFX Application Thread" java.lang.indexoutofboundsexception
    at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.subList(ReadOnlyUnbackedObservableList.java:136)

So I think maybe this is not the right way Any leads?

Solution

In my experience, this is a problem introduced in Java 8u20 In Java 8u05 and 8u11 and JavaFX 2 X, you can add null to the item list and select this item to behave as expected In Java 8u20, whenever you select a null value, you get Java lang.indexoutofboundsexception.

Benjamin gale: you will have to use Java 8u20, in Combo@R_705_2419 @Select an item in the, and then select a null value to view the problem

At present, the best option seems to be to create a special empty object and mark it appropriately, as mentioned earlier

Or, if you can use Choice@R_705_2419 @, I think you'll find it works the way you want

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>