Java Swing UIManager getUnfocusedSelectionBackground()

Here you can find the source of getUnfocusedSelectionBackground()

Description

Get the system-wide unfocused selection background color

License

Open Source License

Declaration

public static Color getUnfocusedSelectionBackground() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;

import javax.swing.UIManager;

public class Main {
    private static Color unfocusedSelBg;

    /**//from w  w  w .j  a va 2s  .  com
     * Get the system-wide unfocused selection background color
     */
    public static Color getUnfocusedSelectionBackground() {
        if (unfocusedSelBg == null) {
            //allow theme/ui custom definition
            unfocusedSelBg = UIManager.getColor("nb.explorer.unfocusedSelBg"); //NOI18N

            if (unfocusedSelBg == null) {
                //try to get standard shadow color
                unfocusedSelBg = UIManager.getColor("controlShadow"); //NOI18N

                if (unfocusedSelBg == null) {
                    //Okay, the look and feel doesn't suport it, punt
                    unfocusedSelBg = Color.lightGray;
                }

                //Lighten it a bit because disabled text will use controlShadow/
                //gray
                if (!Color.WHITE.equals(unfocusedSelBg.brighter())) {
                    unfocusedSelBg = unfocusedSelBg.brighter();
                }
            }
        }

        return unfocusedSelBg;
    }
}

Related

  1. getUIDefaultsOfClass(String className)
  2. getUIDefaultsOfClass(String className)
  3. getUIDefaultsOfClass(String className)
  4. getUIName(Component comp)
  5. getUIPanelBackground()
  6. getUnfocusedSelectionForeground()
  7. getUnfocusedSelectionForeground()
  8. getUnfocusedSelectionForeground()
  9. getWindowsVisualStyle()