本文整理汇总了Java中org.jdesktop.swingx.decorator.ComponentAdapter.convertRowIndexToModel方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentAdapter.convertRowIndexToModel方法的具体用法?Java ComponentAdapter.convertRowIndexToModel怎么用?Java ComponentAdapter.convertRowIndexToModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.decorator.ComponentAdapter
的用法示例。
在下文中一共展示了ComponentAdapter.convertRowIndexToModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interactiveAnimatedBusyPainterHighlight
import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
/**
* Use highlighter with BusyPainter.
*/
public void interactiveAnimatedBusyPainterHighlight() {
TableModel model = new AncientSwingTeam();
JXTable table = new JXTable(model);
table.getColumn(0).setCellRenderer(new DefaultTableRenderer(
new HyperlinkProvider()));
final BusyPainter busyPainter = new BusyPainter() {
/**
* Overridden to fix Issue #861-swingx: must notify on change
* @param frame
*/
// @Override
// public void setFrame(int frame) {
// int old = getFrame();
// super.setFrame(frame);
// firePropertyChange("frame", old, getFrame());
// }
};
// JW: how do we ask for the height of the painter?
table.setRowHeight(26);
PainterHighlighter iconHighlighter = new PainterHighlighter();
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
return
adapter.convertRowIndexToModel(adapter.row) == 1;
}
};
iconHighlighter.setHighlightPredicate(predicate); //HighlightPredicate.ROLLOVER_ROW);
iconHighlighter.setPainter(busyPainter);
ActionListener l = new ActionListener() {
public void actionPerformed(ActionEvent e) {
int frame = busyPainter.getFrame();
frame = (frame+1)%busyPainter.getPoints();
busyPainter.setFrame(frame);
}
};
table.getColumnExt(1).addHighlighter(iconHighlighter);
showWithScrollingInFrame(table,
"Animated highlighter: BusyPainter on Rollover");
Timer timer = new Timer(100, l);
timer.start();
}