Closed dictory99 closed 1 year ago
public class MFXComboBoxCellWithImage
public MFXComboBoxCellWithImage<T> combo, T data) {
super(combo, data);
render(getData());
}
@Override
protected void render(T data) {
super.render(data);
ImageView image = new ........
super.getChildren().add(0, image);
}
}
yourCombo.setCellFactory(data -> new MFXComboBoxCellForm<>(yourCombo, data));
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closed for inactivity.
I had the same question. I reviewed component code and I noted that data
attribute is not setted, so getData()
is going to return null always. I setted the data
attributte in a inhereted class and then invoke render
method overritten.
private static class FieldsCellList(MFXComboBox<Fields> box, Fields field) {
super(box, field);
setData(field);
this.render(getData());
}
@Override
protected void render(Fields field) {
super.render(field);
// This condition is for the call in the `initialize` method invoked by the constructor.
if(getData() == null) return;
Label text = new Label(getData().getDisplayName());
super.getChildren().setAll(field);
}
}
I think that data
attributte should be setted in the original constructor.
Hello!
Is it possible to add an image in MFXComboBox?
I mean like this:
Many thanks!