简体   繁体   中英

Can I do math on items inside 2 JComboBoxes?

So I have two JComboBox es, and what I am trying to do is be able to compare the value in one, with the value in the second and then figure out the difference or the total. I want to be able to input a time in the first box (let's say 8:00 AM ) and then I want to be able to input 5:00 PM in the second box, and have it display 9 .

Is there a way to do this?

I don't have any working code, just need to be steered in the right direction.

您可以在组合框和这些项目侦听itemListener上添加itemListener ,检查是否在其他组合框中选择了某些内容……您可以执行计算。

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.

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