@Override public void initialize(URL location, ResourceBundle resources) { model.AddListener( PrinterService.PRINTERS_FOUND, (data) -> { List<String> printers = (List<String>) data.get("printers"); for (int i = printers.size() - 1; i >= 0; i--) { ObservableList<String> list = FXCollections.observableArrayList(); list.add(printers.get(i)); printerList.setItems(list); } return true; }); ((PrinterService) model.getService(PrinterService.PRINTER_SERVICE_NAME)).listPrinterNames(); }
public void setPrinterAction() { ((PrinterService) model.getService(PrinterService.PRINTER_SERVICE_NAME)) .selectPrinter(printerList.getValue()); }