Java Swing Font applyFont(JPanel p)

Here you can find the source of applyFont(JPanel p)

Description

apply Font

License

Open Source License

Declaration

static void applyFont(JPanel p) 

Method Source Code


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

import java.awt.*;

import javax.swing.JPanel;

public class Main {
    private static final Font guifont = new Font("Arial", Font.BOLD, 12);

    static void applyFont(JPanel p, Font font) {
        Component[] comps = p.getComponents();

        for (Component c : comps) {
            c.setFont(font);//from w w  w  .j  a  v a2s  . c om
        }
    }

    static void applyFont(JPanel p) {
        Component[] comps = p.getComponents();

        for (Component c : comps) {
            c.setFont(guifont);
        }
    }
}

Related

  1. addLabel(Container component, String text, Icon icon, int horizontalAlignment, Font font)
  2. applyComponentFont(JComponent c)
  3. applyProperties(final Component comp, final Color colBack, final Color colFore, final Font font)
  4. autoAwesomeLookAndFeel(String fontName, Map defaults)
  5. boldFont(JComponent component)
  6. clipText(JComponent c, Font fnt, String val, int xFrom, int xTo)