I'm trying to create a JTabbedPane with tabs that will have different colors when selected. For example, let's say I have tabs A, B, and C. If a tab is not selected, then the tab color will be the default. If tab A is selected, then the tab color will change to red. If tab B is selected, then the tab color will change to green. If tab C is selected, then the tab color will change to yellow. How can I achieve this behavior? The closest method I could find was calling UIManager.put("TabbedPane.selected", Color.RED) but this sets the color of all selected tabs to red.
So I figured out how to achieve the desired GUI behavior. To be clear, I wanted to make the selected tab color the same as the unselected tab background color.
I don't really understand WHY this works, but it does work. Just kinda stumbled upon the solution ;-)
tabbedPane = new JTabbedPane();
If anyone can clarify why this code achieves the affect I wanted, do tell. The UIManager.put does not work alone, as one would think.