import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.nimbus.*; public class JListColorsDoNotImplUIResourceInNimbus { public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(new NimbusLookAndFeel()); JList list = new JList(); Color selBackColor = list.getSelectionBackground(); if (!(selBackColor instanceof UIResource)) { throw new RuntimeException(String.format( "JList.getSelectionBackground() returned instance of '%s' instead of UIResource.", selBackColor.getClass())); } Color selForeColor = list.getSelectionForeground(); if (!(selForeColor instanceof UIResource)) { throw new RuntimeException(String.format( "JList.getSelectionForeground() returned instance of '%s' instead of UIResource.", selForeColor.getClass())); } } }