首先要实现roworter和rowfilter java 1.4 [英] Heads up on implementing rowsorter and rowfilter java 1.4
问题描述
有谁可以请教我如何实现我自己的行过滤器和行分类器以应用于Jtable,同时请记住我正在使用Java 1.4?或者,如果有一些可用于此目的的类?
Could anyone please give me a heads-up on how to implement my own row filter and row sorter to apply on a Jtable, while keeping in mind that I'm using Java 1.4? Or if there are some available classes that would serve that purpose?
问候。
推荐答案
你可以使用Philip Milne的 TableSorter
& TableMap
类,讨论已存档此处和这里。 / demo / jfc / TableExample 中包含的完整示例jdk8-downloads-2133151.htmlrel =nofollow> Java SE开发工具包8u65演示和样本
You can use Philip Milne's TableSorter
& TableMap
classes, discussed archived here and here. A complete example in included in /demo/jfc/TableExample
among the Java SE Development Kit 8u65 Demos and Samples
TableSorterDemo
构造函数显示如何使用类。
The TableSorterDemo
constructor shows how to use the classes.
public TableSorterDemo() {
super(new GridLayout(1,0));
TableSorter sorter = new TableSorter(new MyTableModel()); //ADDED THIS
//JTable table = new JTable(new MyTableModel()); //OLD
JTable table = new JTable(sorter); //NEW
sorter.addMouseListenerToHeaderInTable(table); //ADDED THIS
...
}
这篇关于首先要实现roworter和rowfilter java 1.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!