Hello Everyone!

Im making program using java that would look like the (attached file)..
If i will choose an item in the combobox(with 3 choices) the corresponding Price would automatically appear on the Price Jtextfield, im having a difficulty if i should use switch or if then else or both..?

thanks in advance..

If multiple choices( selecting one more items at one time) are allowed you may use "if" but no "else".
For the 3 choices you may simply use Class JCheckBox.
In your layout the selections seem to be more complex than a ckeckbox.

thanks tong1....

okay tong1 will use "if"...

yah you're right its more complex, but the 3 choices in the JCombobox,sorry for that, i meant at least 3, what if ill use 5 choices? maybe the combobox is more appropriate if there are many choices like 5-10 items i want to add and i cannot alter the layout also because its what our professor wanted us to code....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.