java - Rendering nodes in JTree with multiple different fonts -


imagine have jtree showing multiple strings - example list of colors. how possible render such tree different color/font combination? how implement treecellrenderer correctly?

thank help.

you can extend defaulttreecellrenderer. in gettreecellrenderercomponent method call super() , check conditions e.g. analysing value. after call setfont(), setbackground() , setforeground() methods accordingly.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

binding - How can you make the color of elements of a WPF DrawingImage dynamic? -

c# - How to add a new treeview at the selected node? -