Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to set default value selected in JComboBox populated by enum

Below statement in if condition is not working, please provide me some solution that how to set selected item for JComboBox which are populated by ENUM.

      public enum EbayContryEnum 
        {
        AT    (3),
        AU    (4),
        BE    (5),
        CA    (7),
        CH    (14),
        DE    (11),
        ES    (13),
        FR    (10),
        IE    (2),
        IT    (12),
        NL    (16),
        UK    (15),
        US    (1);
        }

for ex:-

if(country.equals("FR"))
                      {
                      cbImportCountry.setSelectedItem("FR");
                      }

But it's not working..

like image 500
astack Avatar asked Dec 18 '13 06:12

astack


2 Answers

cbImportCountry.setSelectedItem(EbayContryEnum.FR);

like image 159
Sanjay Nagare Avatar answered Oct 13 '22 01:10

Sanjay Nagare


cbImportCountry.setSelectedItem(EbayContryEnum.FR);
like image 20
camickr Avatar answered Oct 12 '22 23:10

camickr