I have a custom JList renderer that has an image and some labels. I know how to set the background and foreground of this list using the isSelected variable and the UIManager default L&F.
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
panel.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
panel.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
This works fine but I am unsure about the JLabel's colors though, since there is "selected" color key. As such when the item is selected it doesn't change color and has little contrast.
I found a list of keys I can use to get data from UIManager
but I'm not sure which ones are used for "selected JList item label".
For example on OSX the default is white background with black text. However on selection the cell background is blue and the text becomes white. I want to know how to lookup what color the label turns to (in this case, white). Foreground/background/disabled are the only ones I can find.