Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
上面有很多行显示 jtable。我想通过短代码过滤记录。如果我输入像1234这样的短代码,它应该只在 jtable 上显示与短代码1234相关的行。
谢谢
您将编写代码...首先查看如何使用表格,特别是排序和过滤
基本要求是ActionListener在字段和按钮上附加一个(如果您愿意,可以从表单编辑器中执行此操作)。
ActionListener
在actionPerformed事件处理程序方法中,您需要创建一个RowFilter并将其应用于表RowSorter。
actionPerformed
RowFilter
RowSorter
autoCreateRowSorter通过将属性设置为 ,可以将表配置为自动创建行排序器true。
autoCreateRowSorter
true
这一切都在链接的教程中得到了很好的解释......
另一个例子