Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to use a combo box in java with if else

//using a combobox to do basic sums
int iNum1 = 420;
int iNum2 = 69;

if (combobox.getSelectedItem().equals("Add")) 
  int iAns = iNum1 + iNum2;
else if (combobox.getSelectedItem().equals("Subtract")) 
  int iAns = iNum1 - iNum2;
 
PREVIOUS NEXT
Tagged: #combo #box #java
ADD COMMENT
Topic
Name
8+7 =