Depending on your specific use case, you will not want to use JXBusyLabel as a rendering component (you will not get a view, since this is a visualization tool), all you need is a PainterHighlighter configured with BusyPainter, whose frame property is controlled by a timer. Regardless, the visible artist should be tied to some property of your data that triggers the HighlightPredicate on / off.
As an example, please refer to the interactive PainterVisualCheckAnimatedBusyPainterHighlight tool in the swingx test hierarchy, a package renderer. Sort of:
BusyPainter painter = new BusyPainter(); ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent e) { int frame = busyPainter.getFrame(); frame = (frame+1)%busyPainter.getPoints(); busyPainter.setFrame(frame); } }; Timer timer = new Timer(delay, l); AbstractHighlighter hl = new PainterHighlighter(HighlightPredicate.NEVER, painter); table.getColumnExt().addHighlighter(hl);
Edit (answer to an extended question):
To activate the busy shortcut only for a specific condition, implement a custom HighlightPredicate and set it instead of ALWAYS. FI specific row in the column:
HighlightPredicate predicate = new HighlightPredicate() { @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { return adapter.convertRowIndexToModel(adapter.row) == mySpecialRow; } };
source share