简体   繁体   English

从搜索结果中选择组合框Javafx

[英]Combobox select from search results Javafx

I need to allow a user to pick names from a database. 我需要允许用户从数据库中选择名称。 What I have in mind is a text field that they can start to type a name into and then a dropdown will appear with a list of names that they can pick from. 我想到的是一个文本字段,他们可以开始在其中输入名称,然后将出现一个下拉列表,其中列出了可以选择的名称。 This is a combination of a regular text field and a combobox. 这是常规文本字段和组合框的组合。 I have the database side of this already handled where it takes in characters such as "Aa" and returns "Aaron", "Aardvark", and "Aaliyah". 我已经解决了数据库方面的问题,它接受了诸如“ Aa”之类的字符并返回“ Aaron”,“ Aardvark”和“ Aaliyah”。 They should then only be able to select from "Aaron", "Aardvark", and "Aaliyah". 然后,他们只能从“ Aaron”,“ Aardvark”和“ Aaliyah”中进行选择。

I ended up finding the answer to my question from this answer here: https://stackoverflow.com/a/20282301/6291036 我最终从这里的答案中找到了我的问题的答案: https : //stackoverflow.com/a/20282301/6291036

I used java.net.http to pull the data from the api and converted the json to java variables. 我使用java.net.http从api中提取数据,并将json转换为java变量。 I was then able to put those variables in the combobox items. 然后,我能够将这些变量放入组合框项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM