Java Swing Font installColorsAndFont(Component c, Color background, Color foreground, Font font)

Here you can find the source of installColorsAndFont(Component c, Color background, Color foreground, Font font)

Description

install Colors And Font

License

Open Source License

Declaration

public static void installColorsAndFont(Component c,
                Color background, Color foreground, Font font)
        

Method Source Code

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

import java.awt.Color;
import java.awt.Component;

import java.awt.Font;

import javax.swing.plaf.UIResource;

public class Main {
    public static void installColorsAndFont(Component c, Color background,
            Color foreground, Font font)
    /*      */{//from  w  w w .  ja v a 2s .com
        /* 2324 */installFont(c, font);
        /* 2325 */installColors(c, background, foreground);
        /*      */}

    public static void installFont(Component c, Font font) {
        /* 2329 */Font f = c.getFont();
        /* 2330 */if ((f == null) || ((f instanceof UIResource)))
            /* 2331 */c.setFont(font);
        /*      */}

    public static void installColors(Component c, Color background,
            Color foreground)
    /*      */{
        /* 2337 */Color bg = c.getBackground();
        /* 2338 */if ((background != null)
                && ((bg == null) || ((bg instanceof UIResource)))) {
            /* 2339 */c.setBackground(background);
            /*      */}
        /*      */
        /* 2342 */Color fg = c.getForeground();
        /* 2343 */if ((foreground != null)
                && ((fg == null) || ((fg instanceof UIResource))))
            /* 2344 */c.setForeground(foreground);
        /*      */}
}

Related

  1. getFontColorToUse(boolean isSelected)
  2. getHelpTextArea(String help, Color background, Font font)
  3. getMultiLineTextForBBox(JComponent comp, double bboxWth, String txt, Font font)
  4. increaseDefaultFont(float multiplier)
  5. initGlobalFont(Font font)
  6. installLargerDefaultFonts()
  7. listFonts()
  8. makeFontBold(JComponent c)
  9. makeFontsPlain()