简体   繁体   English

JList中的选定值

[英]Selected value in JList

Could someone tell me how can I get amount of selected value in JList? 有人可以告诉我如何在JList中获取选定值的数量吗? I use MULTIPLE_INTERVAL_SELECTION in my code to select more than one value. 我在代码中使用MULTIPLE_INTERVAL_SELECTION选择多个值。

  1. Read the JList API 阅读JList API
  2. There are two methods that start with getSelected...() . 有两种以getSelected...()开头的方法。 Pick one of the methods to use. 选择一种使用的方法。
  3. Create a loop that iterates through all the values returned from the above method 创建一个循环,循环访问上述方法返回的所有值
  4. Convert each value to a number and add the number 将每个值转换为数字并添加数字
  5. display the total value. 显示总价值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM