如何制作用于搜索的文本字段(具有Google搜索之类的提示)

编程入门 行业动态 更新时间:2024-10-22 05:08:31
本文介绍了如何制作用于搜索的文本字段(具有Google搜索之类的提示)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用Java swing制作PC的窗口应用程序.我想在那里做一个文本字段.在输入该文本字段时,我需要它在该文本字段下显示提示.用户可以从列表中选择所需的文本.就像Google搜索在浏览器中一样.所以我需要两个函数,第一个很简单:通过已经键入的文本过滤一组字符串.但是如何在列表中显示它们呢?

I want to make a window application for PC using java swing. I would like to make a text field there. While typing to that text field I need it to show tips under that text field. And user can select the needed text from the list. The same like the google searching does in the browser. So I need some two functions, first one is easy: filter a set of strings by already typed text. But how to show them in a list ?

如果要在过滤后显示某些内容,则需要显示列表,并且需要使用向上和向下键进行选择.与Google搜索相同,但在PC应用程序上.

I need the list to be shown if there is something to show after filtration, and an ability to select by using keys up and down. The same as google search but on PC application.

推荐答案

JComboBox 是常见选择为了这. AutoCompleteJComboBoxer 是我尝试过的.

JComboBox is a common choice for this. AutoCompleteJComboBoxer is one I've tried.

更多推荐

如何制作用于搜索的文本字段(具有Google搜索之类的提示)

本文发布于:2023-10-25 13:48:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1527132.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   文本   提示   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!