【问题标题】:Puzzle: what's wrong with this snippet [closed]谜题:这个片段有什么问题[关闭]
【发布时间】:2012-09-05 16:06:29
【问题描述】:

...以及它是如何发生的(当然允许猜测 :-)

@Override
public int convertChildIndexToModel(int modelIndex) {
    return getRowSorter() != null ? getRowSorter()
            .convertRowIndexToView(modelIndex) : modelIndex;
}

@Override
public int convertChildIndexToView(int viewIndex) {
    return getRowSorter() != null ? getRowSorter()
            .convertRowIndexToModel(viewIndex) : viewIndex;
}

是的,白痴是我;-)

【问题讨论】:

标签: java swing jtable tablerowsorter


【解决方案1】:

modelIndex 调用convertRowIndexToView,反之亦然。一定是一些复制粘贴错误:)

【讨论】:

  • +1 并以最快的速度被接受:-)
【解决方案2】:

是不是因为你应该在convertChildIndexToModel 中调用convertRowIndexToModel,反之亦然?

【讨论】:

  • 准确地发现了错误:-)
猜你喜欢
  • 2011-03-30
  • 1970-01-01
  • 1970-01-01
  • 2012-08-04
  • 1970-01-01
相关资源
最近更新 更多