Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- material_comboBox_type.getItems().addAll(types);
- material_comboBox_type.setCellFactory((ListView<SimpleTableObject>
- param) -> {
- final ListCell<SimpleTableObject> cell = new
- ListCell<SimpleTableObject>() {
- @Override
- public void updateItem(SimpleTableObject item, boolean empty) {
- super.updateItem(item, empty);
- if (item != null) {
- setText(item.getName().get());//return String, actuall name of material
- }
- else {
- setText(null);
- }
- }
- };
- return cell;
- });
- private static class SimpleTableObjectListCell extends ListCell<SimpleTableObject> {
- @Override
- public void updateItem(SimpleTableObject item, boolean empty) {
- super.updateItem(item, empty);
- if (item != null) {
- setText(item.getName().get());//return String, actuall name of material
- }
- else {
- setText(null);
- }
- }
- }
- materialComboBoxType.setCellFactory(listView -> new SimpleTableObjectListCell());
- materialComboBoxType.setButtonCell(new SimpleTableObjectListCell());
- material_comboBox_type.setConverter(new StringConverter<SimpleTableObject>() {
- @Override
- public String toString(SimpleTableObject object) {
- return object.getName().get();
- }
- @Override
- public SimpleTableObject fromString(String string) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- });
Add Comment
Please, Sign In to add comment