A would like to add default text when the drop-down menu is loaded on my view. How can I do this in SWT and JFace?
I'm guessing what you want to do is to show something in the combo when it has been added to the view (it's blank by default until something is selected or typed).
If you want to set a default text displayed until a selection has been made / until the field has been edited, e.g. - Select option -, then you can use:
Combo.setText(String string)
Note, this is not possible if the Combo is SWT.READ_ONLY
If you want to set one of the values in the drop-down as default use the select method:
Combo.select(int index)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With