java - Casting combobox objects back to their correct type -


I have a combo box of objects (two types; product groups and family)

I have a Went out on the limb and tried

  if (cbFamily.getSelectedItem) for example product group (host), {joppenpan. Show Message Dialeg (Main Window, "You Have Selected a Product Group")}   

I had no luck

Note: I am new to Java I may have to ask more explanation on some answers.

Your code should work fine The problem will be somewhere else. Use the debugger, or "system.out.println (cbFamily.getSelectedItem). Write" getClass ()); "Before your" if "to determine which square has been returned from your combobox.

Comments