rdemolish
rdemolish

Reputation: 55

Can I do math on items inside 2 JComboBoxes?

So I have two JComboBoxes, 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 A.M) and then I want to be able to input 5:00 P.M 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.

Upvotes: 0

Views: 70

Answers (1)

rahul pasricha
rahul pasricha

Reputation: 931

you can add itemListener on both the comboboxes and in those item listeners, check if there is something selected in other combobox...accordingly you can perform your calculations....

Upvotes: 1

Related Questions