final Map map = new TreeMap<>(); private void fillMap() { Properties prop = new Properties(); this.getClass().getResourceAsStream("C:/Users/Emir/OneDrive/Documents/NewOne/LibraryManagementSystem/src/main/java/companyProperty"); prop.forEach((key, value) -> map.put(key.toString(), value.toString().split(","))); map.forEach((k, v) -> System.out.println(k + ": " + Arrays.toString(v))); } public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { fillMap(); stage.setTitle("ComboBoxSample"); Scene scene = new Scene(new Group()); final ComboBox company = new ComboBox<>(); company.getItems().addAll(new ArrayList<>(map.keySet())); final ComboBox priorityComboBox = new ComboBox<>(); priorityComboBox.getItems().addAll(new ArrayList<>(map.keySet())); /*company.setCellFactory(lv -> new ListCell<>() { public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); } else { setText(item); switch (item) { case "Automotive": case "Engineering, various": case "Electronics": case "Pharmaceuticals": case "Aerospace & Defense": case "Chemicals": case "Food & Beverages": case "Steel": setOpacity(0.5); setDisable(true); break; default: setOpacity(2); setDisable(false); } } } }); company.valueProperty().addListener((ov, t, t1) -> { char firstIDLetter = t1.toUpperCase().charAt(0); char secondIDLetter = t1.toUpperCase().charAt(t1.length() - 1); *//* System.out.println(ov);*//* *//*System.out.println(t); Previous value *//* System.out.printf("%s%s", firstIDLetter, secondIDLetter); });*/ priorityComboBox.setValue("Normal"); company.setValue("Hydrotec Military Vehicles"); GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("Companies: "), 0, 0); grid.add(company, 1, 0); grid.add(new Label("Products: "), 0, 1); grid.add(priorityComboBox, 1, 1); /*grid.add(new Label("Subject: "), 0, 1); grid.add(subject, 1, 1, 3, 1);*/ /* grid.add(text, 0, 2, 4, 1);*/ /* grid.add(button, 0, 3);*/ grid.setVgap(15); /*grid.add(notification, 1, 3, 3, 1);*/ Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); } }