I have a Combo box/Dropdown and when a user clicks an option I want the combo box to set the text onto a jTextField.
For example:
if(carsJComboBox.getSelectedIndex() == 0)
{
currentCarsJTextField.setText("250 Million");
}
if(carsJComboBox.getSelectedIndex() == 1)
{
currentCarsJTextField.setText("500 Million");
}
The problem is that when the program runs, it automatically sets 250 Million to the JTextField. I understand why it does that because 250 Million is the first drop down option, but the JTextField never updates. When I choose the option below 250 Million, which is 500 Miliion and click on it, it doesn't set the JTextField text to 500 Million.
Also, is there a way I could add the two numbers. For example: I choose 250 Million, then choose 500 Million and the JTextField sets the text to 750 Million?
This might be a bit confusing but thank you.