Java Swing Font getFontColorToUse(boolean isSelected)

Here you can find the source of getFontColorToUse(boolean isSelected)

Description

get Font Color To Use

License

Apache License

Declaration

public static Color getFontColorToUse(boolean isSelected) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Color;
import javax.swing.UIManager;

public class Main {
    public static final String LOOK_AND_FEEL_NAME = UIManager
            .getLookAndFeel().getName();
    public static final Color FONT_COLOR_NORMAL = Color.decode("0x0000B2");
    public static final Color FONT_COLOR_DARK = Color.decode("#46F25A");

    public static Color getFontColorToUse(boolean isSelected) {
        Color fontColorToUse;/*w  ww. j av a 2 s .  co  m*/
        if (isSelected) {
            fontColorToUse = Color.WHITE;
        } else {
            //TODO verify this to improve the way to deal with Colors on look and feels:
            //https://netbeans.org/bugzilla/show_bug.cgi?id=257867
            if (LOOK_AND_FEEL_NAME.contains("Dark")
                    || LOOK_AND_FEEL_NAME.equalsIgnoreCase("Darcula")) {
                fontColorToUse = FONT_COLOR_DARK;
            } else {
                fontColorToUse = FONT_COLOR_NORMAL;
            }
        }
        return fontColorToUse;
    }
}

Related

  1. getAsNotUIResource(Font font)
  2. getDefaultFont()
  3. getDefaultLabelBoldFont()
  4. getDefaultLabelFont()
  5. getFont(String name)
  6. getHelpTextArea(String help, Color background, Font font)
  7. getMultiLineTextForBBox(JComponent comp, double bboxWth, String txt, Font font)
  8. increaseDefaultFont(float multiplier)
  9. initGlobalFont(Font font)