How to preselect an item from a combobox?

Hi,
I ‘am trying to display a comboBox with some item PRE-SELECTED; but it doesn’t want to work.
Could somebody take a look at this code and provide some help?
Thanks

public class ComboLocales extends ComboBox {

	private final List<Locale> locales = MyApplication.getInstance().getAvailableLocales();
	private final Locale actualLocale = MyApplication.getInstance().getActualLocale();
		
	public ComboLocales() {    	    
    	BeanItemContainer<Locale> container = new BeanItemContainer<Locale>(Locale.class);
    		container.addAll(locales);

		this.setCaption("Locales");    	    	
    	this.setContainerDataSource(container);    	
        this.setItemCaptionPropertyId("displayName");
		
		this.setValue(actualLocale);		
	}
             
}

Have you checked that your
actualLocale
is actually in your
locales
list?

My combo doesn’t really work with java.util.Locale beans; instead it loads beans of a particular ‘Local’ class.

I ‘am wondering myself if I need to implement
equals
method in my Local class. ¿?

Here some of the involved code:

public class ComboIdiomas extends ComboBox implements ValueChangeListener {

	private final ResourceBundle bundle = MyApplication.getInstance().bundle;
	private final List<Local> locales = MyApplication.getInstance().locales;
		
	public ComboIdiomas() {    	    
    	BeanItemContainer<Local> container = new BeanItemContainer<Local>(Local.class);
    		container.addAll(locales);

		this.setCaption(bundle.getString(Captions.fldIdioma));    	    	
    	this.setContainerDataSource(container);    	
        this.setItemCaptionPropertyId("nombreCompleto");
        this.setItemIconPropertyId("bandera");
        this.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH);
                                
	}
    
}
public class Local implements Serializable {

	private Integer id;
	private String nombreCulturaGlobal;
	private String siglasCulturaGlobal;
	private ExternalResource bandera;
	private String nombreCompleto;
	
	//getters&setters ommitted for brevity
	//JPA/Hibernate annotations also ommited
				
}
public class FieldFactoryAdministrador extends DefaultFieldFactory {
	
    final ComboBox comboIdiomas = new ComboIdiomas();
    final Local local = MyApplication.getInstance().administrador.getLocal();

	//...
	
    @Override
    public Field createField(Item item, Object propertyId, Component uiContext) {    	
    	Field f;
        if ("local".equals(propertyId)) {
        	comboIdiomas.setValue(local.getId());
            return comboIdiomas;
		}
		//ETC..
	}

}

Problem solved.

Effectively I have to implement
equals
method in my Local bean class.

public boolean equals(Object local) {
	    if (this == local) {
	    	return true;
	    }
	    if (!(local instanceof Local)) {
	    	return false;
	    }
	    return this.getNombreCompleto().equals(((Local)local).getNombreCompleto());	    
	}