In Swing when using a JTree/JList/JTable selecting an item changes its background color. Is there any way to retrieve this color for the current look and feel when the component is not selected? Thank you.
In Swing when using a JTree/JList/JTable selecting an item changes its background color. Is
Share
You can use :
Other useful values are:
EDIT: The other solutions proposed work of course but the downside is that you need a component and it has to be selected before you can call the method or you’ll get the non-selected background. This solution can be called even if you don’t have a tree to begin with 🙂