myJList.setSelectedValue("someTHING", true); //if "SomeThing" in the list, it won't be selected
I want to set the value, but seems like setSelectedValue is case-sensitive, I want to select a value but ignore case-sensitive, is it possible? and how?
Instead of adding String
objects to your ListModel
you could write your own String
wrapper and override the equals(Object o)
method to be case insensitive. This might have implications for other areas of your app.
I can't see any one shot method for that but merging one or two method you can have this.
call getNextMatch()
until you find the exact element and then setSelectedValue
setSelectedValue() is not case sensitive, Java is case sensitive.
Two solutions:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.