Am kind of a beginner. I have an application in which I have a combo box. The combo box has two strings/items 1 being "Add" and 2nd being "Minus". If I select "Add" from the combo box my jText field should display the word "Addition" and if I select "Minus" from the combo box the jText field should display the word "Subtraction". My issue is it only displays "Addition" if I select add, but if I selects "Minus" it doesn't display "Subtraction".
Is there something wrong with my if statement??
String display ="";
if (comboBxOperator.getSelectedItem().equals("ADD"))
{
display = "Addition";
}
else if (comboBxOperator.getSelectedItem().equals("Minus"))
{
display = "Subtraction";
}
txtDisplay.setText(display);
Update: After I implemented the acionListener for my combo Box I get"UnsupportedOperationException":
comboBxOperator.addActionListener(this);