AnimatedIcon doesn't work inside a DefaultMutableTreeNode
Answered
I found it `https://intellij-support.jetbrains.com/hc/en-us/community/posts/11525525651474-AnimatedIcon-doesn-t-work-inside-a-DefaultMutableTreeNode This article`, but it's not what I want. I want to add "AnimatedIcon. Default" on the left side. I have already added it, but this icon won't start animation. It only starts animation when the window size is changed
Please sign in to leave a comment.
I don't understand https://intellij-support.jetbrains.com/hc/en-us/community/posts/11842133574290-How-to-make-the-tree-have-a-loading-icon Can you give me more hints about the answer
Hi,
It's unclear where you want to use it. Please share your current code.
I use it in ColoredTreeCellRenderer
class Test extends ColoredTreeCellRenderer {
private static final Icon loading =new AnimatedIcon.Default();
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
setIcon(loading);
append("loading");
}
}
it is static and won't move
I experience same problem. I use
Tree
withColoredTreeCellRenderer
, set icon and see it updating only when render required, e.g. window resizeI expect it to spin always. Karol, could you give a tip how to achieve this behaviour?
Bee Master, have you solved it?
Hi,
Try to invoke:
on your tree instance. See
ANIMATION_IN_RENDERER_ALLOWED
's Javadoc.Also, reuse
AnimatedIcon.Default.INSTANCE
.it worked,You have an impressive ability to solve problems efficiently and effectively.
Works like a charm! Thank you Karol!