JDialog 中的复选框列表

发布于 2024-09-07 04:14:35 字数 135 浏览 1 评论 0原文

我正在尝试使用具有搜索文本字段的 JDialog 框,当输入文本时,它会将列表缩短为匹配的列表。在此列表中,我想显示带有可以选择的复选框的每一行。我可能还希望它能够像全选列表一样运行,其中 Ctrl + 单击该行将选择该项目并选中其框。我该如何完成这件事?

I'm trying to use a JDialog box that has a search text field that as text is entered, it shortens a list to those that match. On this list I would like to display each line with a checkbox that can be selected. I might also want the ability for it to function like a select all list where Ctrl + Click on the line would select the item and check its box. How do I get this done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扬花落满肩 2024-09-14 04:14:51

我将使用具有两列的 JTable。第一列可以是您的复选框,第二列可以是文本。

阅读 Swing 教程中有关“如何使用表”的部分,特别是 排序和过滤作为示例。

I would use a JTable with two columns. The first column can be your check box and the second column could be the text.

Read the section from the Swing tutorial on "How to Use Tables" in particular the part on Sorting and Filtering for an example.

通知家属抬走 2024-09-14 04:14:47

Jlist 正是您正在寻找的东西。您可以使用复选框列表并按住 Ctrl 键单击它们。

Jlist is exactly what you're looking for. You can use a list of checkboxes and ctrl-click them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文