setInputPromp for ComboBox in vaadin Form

Hello,

i need help. Can anyone tell me why the Text I wrote with setInputPromp for my Combobox in vaadin Form is not working directly?
see screenshot ComboBox1.jpg

The code is like this:


public class EnrollmentFieldFactory extends DefaultFieldFactory {
	public EnrollmentFieldFactory() {

	}

	@Override
	public Field createField(Item item, Object propertyId, Component uiContext) {
		// Identify the fields by their Property ID.
		String pid = (String) propertyId;
		if ("treatmentGroup".equals(pid)) {
			TextField treatmentGroup = new TextField("Subject Group");
			treatmentGroup.setWidth("280px");
			return treatmentGroup;
		} else if ("birth".equals(pid)) {
			TextField birth = new TextField("Date of Birth");
			birth.setWidth("280px");
			return birth;
		} else if ("sex".equals(pid)) {
			ComboBox gender = new ComboBox("Sex");
			gender.setImmediate(true);
			gender.setWidth("300px");
			gender.setNewItemsAllowed(false);
			// Add an item
			Object male = gender.addItem();
			Object female = gender.addItem();
			gender.setItemCaption(male, "Male");
			gender.setItemCaption(female, "Female");
			gender.setInputPrompt("-select-");
			return gender;
		} else if ("enrollmentDate".equals(pid)) {
			TextField enrollmentDate = new TextField("Enrollment Date");
			enrollmentDate.setWidth("280px");
			return enrollmentDate;
		} else if ("patientId".equals(pid)) {
			TextField patientId = new TextField("Person Id");
			patientId.setWidth("280px");
			return patientId;
		} else if ("subjectId".equals(pid)) {
			ComboBox subjectIds = new ComboBox("Subject Id");
			subjectIds.setImmediate(true);
			subjectIds.setNewItemsAllowed(false);
			subjectIds.setMultiSelect(false);
			subjectIds.setWidth("300px");
			for (int i = 0; i < 3; i++) {
				String id = "DCR00" + (i + 7);
				subjectIds.addItem(id);
			}
			subjectIds.setInputPrompt("-select-");
			return subjectIds;
		} else {
			return null;
		}
	}
}

public class EnrollmentWindow extends Window {

	private static final long serialVersionUID = 7598963596997579520L;

	Patient patient;

	public EnrollmentWindow(String caption) {
		super(caption);
		// make it modal
		setModal(true);

		setWidth(500, UNITS_PIXELS);
		setHeight(500, UNITS_PIXELS);
		initialize();
	}

	public void initialize() {
		patient = new PatientImpl();

		BeanItem<Patient> pItem = new BeanItem<Patient>(patient);

		// A FormLayout used outside the context of a Form
		final Form form = new Form();
		form.addStyleName("subject-enrollment");
		addComponent(form);

		form.setSizeFull();
		form.setFormFieldFactory(new EnrollmentFieldFactory());

		form.setItemDataSource(pItem);

		form.setImmediate(true);

		// Have a button bar in the footer.
		HorizontalLayout okbar = new HorizontalLayout();
		okbar.setHeight("25px");
		form.getFooter().addComponent(okbar);

		// the button for adding subject
		Button addSubject = new Button("Add Subject");

		// the button for canceling
		Button cancel = new Button("Cancel");

		HorizontalLayout buttons = new HorizontalLayout();
		buttons.setSpacing(true);
		buttons.addComponent(addSubject);
		buttons.addComponent(cancel);
		form.getFooter().addComponent(buttons);
	}
}

Only after i clicked the ComboBox, the inputPromp is shown. (see the second screenshot ComboBox2.jpg)

Can anyone please help me or give me an advice?
12445.jpg
12446.jpg