3

我正在使用此处此处的 Glazed List 教程,但这意味着您需要一个比较器来对行进行排序。但是,我似乎无法弄清楚如何添加对基于表头点击的排序的支持。

4

1 回答 1

1

经过更多的尝试和错误,我发现我做错了什么。

EventTableModel 必须用实例实例化,而SortedList不是EventList. 从例子:

private EventList<Issue> issuesEventList = new BasicEventList<Issue>();
...

        SortedList<Issue> sortedIssues = new SortedList<Issue>(issuesEventList, null);

        // create a panel with a table
        JPanel panel = new JPanel();
        // be careful not to put issuesEventList in here, it has to be the sortedIssues list
        EventTableModel<Issue> issuesTableModel = new EventTableModel<Issue>(sortedIssues, new IssueTableFormat());
于 2012-05-03T16:15:48.883 回答