Reputation: 11
I have a combo box with a list of entries and when I choose an entry eg dog I want to display an image of a dog beside the combo box. Would anybody have any examples of this in swt that I could take a look at?
Ann.
Upvotes: 1
Views: 366
Reputation: 4617
Add a SelectionListener
to your combo box.
combo.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent event ) {
// ...
}
} );
On the widgetSelected
method, get the selection index - using combo.getSelectionIndex()
-, map it to your image and display it wherever you want (e.g. on a Label: label.setImage(image)
).
Upvotes: 3